lua-users home
lua-l archive

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


On Apr 30, 2013, at 12:47 AM, Philipp Janda <siffiejoe@gmx.net> wrote:

> Am 29.04.2013 23:31 schröbte Petite Abeille:
>> 
>> But… _ENV is not the global environment... _G is.
> 
> To figure out which environment should be considered a "global" environment would require some convention like: only environments passed to one of the load* functions are global environments, or any environment that contains (most of) the Lua standard library is a global environment, or if there's a field _ENV._G that refers back to _ENV, then _ENV is considered a global environment.

Nah. _G is always at LUA_RIDX_GLOBALS. And that is that.

http://www.lua.org/manual/5.2/manual.html#2.2
http://www.lua.org/manual/5.2/manual.html#4.5

> But all this can only be checked at runtime anyway:

Most likely yes. 

R.I.P. byte code analyzes for globals in 5.2. Oh, well...