lua-users home
lua-l archive

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

As stated in the manual at the assignment statement should first evaluate all its expressions and only then the assignments should be performed.
However, this seems to not always be the case.
The following code shows the problem:

local up = {}
setmetatable(up, {__newindex=function()
    up = ""

local function test()
    up.x, up.y = 1, 1


This failes with: attempt to index a string value (upvalue 'up').
However, I would expect from the manual that
a=up, b=up, c=1, d=1 are evaluated (in any order) as they are expressions and then the assignments a.x = c, b.y = d are assigned in any order which would not result in the error observed.

Am I missing something from the manual or is this a bug?