lua-users home
lua-l archive

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


Thanks for the info.  I don't think we are ready to switch to 5.1 yet, but we will definitely
switch in the coming months. 

Just as an experiment, I forcibly set L->errfunc before calling lua_resume (using a technique
similar to what lua_pcall does).  That seemed to work just fine - my error handler function was
called, and I was able to display a callstack and inspect variables.  But I noticed the following
line in lua_resume:

lua_assert(L->errfunc == 0 && L->nCcalls == 0);

This certainly makes it seem risky.   Is this bound to cause other problems down the road?  It
seems like it should be OK, as long as we don't use the thread again after lua_resume returns with
the error status (which we don't).

-Moe


--- Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:

> > I am wondering if there is an easy way to set an error handler
> > function when calling lua_resume.
> 
> No :(
> 
> 
> > But it appears that the stack has been unwound by the time lua_resume
> > returns.
> 
> This changed in 5.1. Now you can do a traceback after an ocasional error.
> 
> -- Roberto
>