lua-users home
lua-l archive

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


On Sun, Jan 10, 2010 at 7:36 PM, François Perrad
<francois.perrad@gadz.org> wrote:
>    debug.setfenv(debug.getinfo(3, 'f').func, M)

Useful to keep in mind!

> The param 'f' seems optional.

Without a parameter, getinfo() returns a table with everything, so
passing 'f' is more efficient:

> d = table.print  -- from metalua libs (very useful!)
> d ( debug.getinfo(0,'f') )
{ func = function: 0x80711e0 }
> d ( debug.getinfo(0) )
{ source = "=[C]", what = "C", func = function: 0x80711e0, nparams =
0, namewhat = "field", istailcall = false, name = "getinfo", short_src
= "[C]", nups = 0, currentline = -1, isvararg = true, linedefined =
-1, lastlinedefined = -1 }

> What is the level of stability of the interface of debug.getinfo() ?

Well, that is the question.  The major question in my mind is whether
lua_getfenv/setfenv will continue to have all their functionality; if
so, then it is fairly easy to write a C extension that exports them.

steve d.