lua-users home
lua-l archive

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



I would like to read the function name on the stack element i. How can I read the name?

It looks like you're confusing the C API's stack with the interpreter's runtime stack.  They're different animals :)

The stack exposed in the C API is basically just a mechanism for passing arguments to C functions -- that's the stack you're interacting with when you call lua_iscfunction.  In the context of the C-API's stack, functions don't have names.  They're just pointers.

lua_getinfo, lua_getstack, and luaL_traceback are all tools for analyzing the runtime stack.  They're what you want to use to get a string representation of Lua's execution state. 

-Sven