lua-users home
lua-l archive

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

On 10/08/2011, at 11:12 AM, Ross Andrews wrote:

> By "order of assignment is undefined", does it mean that the order in which values are put in variables is undefined, or the order in which the right-hand side is evaluated is undefined?

I think you're asking something like "how is the right hand side mapped to the left hand side?".  You can be confident that "a,b = 1,2" leads to a being 1 and b being 2.

If you mean what you said, then pages 6&7 of the LRM don't mention an order for evaluation of the right-hand side of a multiple assignment:

c = 1
function f()
  c = c + 1
  return c

a, b = f(), f()

print(a, b)  -- could be "2 3" or "3 2", but both Lua and LuaJIT print "2 3"