Lua traceback off the stack?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Lua traceback off the stack?

Chris Jones
Hey folks

Does anyone happen to know of some pre-existing C that does what luaL_traceback does, but returns the traceback as some kind of C datastructure (a flat string, or an array of strings, I imagine) rather than pushing it onto the Lua stack? I'd like to have such a thing for debug logging purposes.

Cheers,
--
Cheers,

Chris
Reply | Threaded
Open this post in threaded view
|

Re: Lua traceback off the stack?

Roberto Ierusalimschy
> Does anyone happen to know of some pre-existing C that does what
> luaL_traceback does, but returns the traceback as some kind of C
> datastructure (a flat string, or an array of strings, I imagine) rather
> than pushing it onto the Lua stack? I'd like to have such a thing for debug
> logging purposes.

'luaL_traceback' produces a flat string. You only need to get it from
the stack. If you don't want to keep that string in Lua, make a copy
for your onw use.

-- Roberto