On Sun, Feb 11, 2018 at 4:55 PM, albertmcchan wrote:
does comma operator always process from left to right ?
It's easy to check that both vanilla Lua and LuaJIT prepare values from left to right and then assign them from right to left:
local t = setmetatable({}, {__newindex =
function(t, k, v)
print(k)
end
})
local function f(v)
print(v)
end
t.a, t.b = f("c"), f("d")
Output:
c
d
b
a