[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: bug report: LUA compiler glitch
- From: Geoff Leyland <geoff_leyland@...>
- Date: Wed, 10 Aug 2011 11:29:11 +1200
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
end
a, b = f(), f()
print(a, b) -- could be "2 3" or "3 2", but both Lua and LuaJIT print "2 3"
Cheers,
Geoff