lua-users home
lua-l archive

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

Hi all, I've been attempting to draw some information about functions that reside on the stack frame (just for debugging purposes). I have a function that I gleamed from an online resource (can't remember where) that looks like this:

But I really want to handle the LUA_TFUNCTION type, and possibly print out if the function is a cfunc or luafunc. If it's a luafunc I'd also like to know it's name.

I've tried to use lua_getstack and lua_getinfo, something along the lines of:

          case LUA_TFUNCTION:
              lua_Debug ar;
              lua_getstack(luaState, i - 1, &ar);
              lua_getinfo(luaState, ">Sn", &ar);

But I think getinfo would pop the function, which wasn't much help when I wanted to query the stack without modifying it.

Any suggestions?