lua-users home
lua-l archive

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


Dirk Laurie <dpl@sun.ac.za> writes:

> On Wed, Jun 15, 2011 at 03:50:00PM +0200, Fredrik Widlund wrote:
>> Ok, thank you! So in a list of expr a vararg is evaluated to the first
>> element of the vararg unless last in the list. 
>> 
>> May I ask why this is?
>> 
>
> Suppose f and g both return a variable number of values.
>
> a,b,c = f(),g()
>
> At present we know that a will get the first value from f,
> b the first value from g, c the second value from g.
>
> If the rule was not there, we would not know whether b will get 
> the second value from f or the first value from g, etc.

Actually, you would not even know whether a gets its value from g, since
f could just do "return", returning no values at all.

-- 
David Kastrup