lua-users home
lua-l archive

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

> You can see that _G and the current environment are the same thing by  
> doing this:

To be more exact, _G *starts* holding the current environment, but it's not
automatically updated when you change the environment:

> a=1
> print(a,_G,getfenv())
1	table: 0x8066b08	table: 0x8066b08
> setfenv(1,{a=2,getfenv=getfenv,print=print})
> print(a,_G,getfenv())
2	nil	table: 0x806b8f0