lua-users home
lua-l archive

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


> I amended the example in the original question to make _ENV to be the
> first upvalue:

When in doubt, read the code:

http://www.lua.org/source/5.2/lapi.c.html#lua_load

It only sets the first upvalue if there is exactly one upvalue, which is
the case for main chunks. Again, this is what the manual promises: that
main chunks will be loaded with the correct _ENV.