lua-users home
lua-l archive

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


On 9/14/12, Dimitris Papavasiliou <dpapavas@gmail.com> wrote:
> for v = f() do ... end
> if you use a function call one would expect it to work like:
> v = f()
> in which case the returned values would be adjusted to a single value
> as happens for the for statement.  You can therefore treat the part of
> the for statement that looks like an assignment as an actual
> assignment in terms of semantics.  From this point of view not
> adjusting the values returned by f would be then inconsistent thing to
> do.

Yes, it can be confusing a bit for Lua newbies.
But current syntax is also confusing exactly the same way:
for i = 1, 5 do ... end
One can erroneously treat it as an assignment because of '=' sign.