Re: lua_pcall
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: lua_pcall
- From: RLake@...
- Date: Wed, 4 Feb 2004 13:43:03 -0500
> Is there some sample source code showing how to use lua_pcall with
> err_func != 0? Basically when I'm calling into Lua and an error
> occurs I'd like to see the debug traceback, but I'm not quite sure how
> to do that based on the docs.
Probably the best sample code is in lua.c, which shows how to call
a traceback function. The traceback function itself is in the debug
library, and you can use it as a guide on how to walk the stack, if
you want to do your own.
The key thing to remember is that the err_func runs before the
error is thrown, so it still has the whole stack available to it.
Once the error is thrown, the stack is cleaned.