lua-users home
lua-l archive

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


Hey,

LuaJit has no way of knowing that you didn't run this code before the chunk you gave:
setmetatable(_G, { __newindex = function(tab, key, val)
 print "setting global "..key
 rawset(tab, key, val)
end })

Or similar. It is possible for later Jiters to optimize the value to a local register and check that the global table still has no metamethods before each access, but jit 1.x definitely does not do this. And it would only encourage bad programming practices if it did imo. Use locals :)

- Alex