lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Thu, 20 Feb 2020 at 22:26, Egor Skriptunoff
<> wrote:
> On Fri, Feb 21, 2020 at 12:53 AM Dibyendu Majumdar wrote:
>> 2. If the function call is in an assignment expression and is the last
>> expression, then the number of return values to accept is equal to
>> corresponding var plus any excess vars.
> Should f() be invoked here? What is the number of return values?
> local x,y = 1,2,3,f()

You are right - my description was inadequate. In an assignment
statement if there are less vars than expressions then any results
from any exprs that are excess are discarded. The rule I mention only
applies when number of vars >= number of expressions.

>> 3. In all other cases the function return values are truncated to 1 result.
> No.
> In Lua functions may be used as procedures (truncated to 0 results):
> f()


Thanks for pointing out these.