lua-users home
lua-l archive

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


Cuero Bugot <cbugot@sierrawireless.com> writes:

> Thanks guys for raising this very flammable subject that is table as
> list and holes, etc...
> Once again few where able to divert the subject :).
> I love Lua table approach and it's well defined # operator (that was
> for the troll part).
>
>
> That said I was very interested in the first question: why the
> returned values of called function are trimmed to one value, unless it
> is the last one. I mean: I would like to understand the rational
> behind it.

They are not only _trimmed_ to one value, but also _extended_ to one
value if necessary.

If I write
a,b,c = f(), g(), h()
do I want to think about whether a will be set to the result of h()
because f and g choose to return nothing?  Or c be set to the value of
g() because a returned nil and an error string?

> If the answer is 'limit weird behavior' then it appears that it might
> seem that this trimming is also considered weird by some.

It is "limit", not "eliminate".

-- 
David Kastrup