lua-users home
lua-l archive

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


> > BTW, note that setfenv/getfenv are not moving to the debug library, but
> > out of the language, as functions will not have environments anymore.
> 
> Hmmm...
> 
> http://lua-users.org/lists/lua-l/2010-02/msg00753.html
> 
> * setfenv becomes 'set the upvalue named _ENV' (which is clearly
> a debug operation). If the function is the main function of a chunk,
> it must have only one upvalue, named _ENV.
> 
> Doesn't that imply that there still will be a setfenv/getfenv which
> will work in term of that new _ENV thingy, no?

No. It implies that you will be able to do what setfenv/getfenv did
by using debug.setupvalue/debug.getupvalue. (There are some caveats
[see message from Mark Hamburg], but it is mostly doable.)

-- Roberto