[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua parsing question
- From: Dibyendu Majumdar <mobile@...>
- Date: Thu, 20 Feb 2020 23:10:58 +0000
On Thu, 20 Feb 2020 at 22:26, Egor Skriptunoff
> 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.
> In Lua functions may be used as procedures (truncated to 0 results):
Thanks for pointing out these.