lua-users home
lua-l archive

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


> > > <snip>
> > > BTW, is it guaranteed that the assignment order goes from RIGHT to
> > > LEFT (I verified this in Lua 5.1, 5.2, 5.3, LuaJIT), or is it
> > > "undefined behavior"?
> >
> > It is not undefined behavior at all.
> > <snip>
> > It is like in C, which does not specify the order of evaluation of
> > expressions in argument lists in function calls.
> 
> You actually prove my point here. The C standard *does* say that the
> order is "unspecified". [...]

Check your words. "unspecified behavior" (what the C standard says) is
different from "undefined behavior" (what you asked about). Lhf is
correct in saying that the behavior is not undefined, even though it is
unspecified.

About the manual itself: there are infinite things that Lua does not do
but the manual fails to mention. So, if the manual does not define in
what order __newindex metamethods in multiple assignments are called,
it is safe to assume that the order is unspecified, even if the manual
does not say that.

-- Roberto