lua-users home
lua-l archive

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


Ok, but the below example can of course trivially be rewritten as
a=f()
b,c=g()

Whereas I can't rewrite around my problem...

Fredrik


________________________________________
Från: lua-l-bounces@lists.lua.org [lua-l-bounces@lists.lua.org] för Dirk Laurie [dpl@sun.ac.za]
Skickat: den 15 juni 2011 16:32
Till: Lua mailing list
Ämne: Re: SV: pack/unpack

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.

Dirk