lua-users home
lua-l archive

Re: Deprecating setfenv()

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


In Lua 5.1, setfenv(f, table) & debug.setfenv(object, table) are not
equivalent, debug.setfenv() is a low level function.
In my module lua-Coat (http://github.com/fperrad/lua-Coat/), I use
setfenv with a stack level.
With Lua 5.2, the following code :
 setfenv(3, M)
could be rewrite (and work with Lua 5.1 & Lua 5.2)
 require 'debug'
 ...
 debug.setfenv(debug.getinfo(3, 'f').func, M)
The param 'f' seems optional.
What is the level of stability of the interface of debug.getinfo() ?

AltStyle によって変換されたページ (->オリジナル) /