[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: coroutines and error handling
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 26 Jun 2003 09:11:11 -0300
> I also noticed a
> lua_assert(L->errfunc == 0 && L->nCcalls == 0);
> in lua_resume, so I guess I can't/shouldn't set an error function before
> resuming. But how can I add an error function "inside" the resume without
> doing it in a new c function causing the above error?
Currently there is no way to do that :(
> And, if it's not possible with the given lua implementation, why can't I
> just modify lua_resume to include an error handler? (there must be some
> reason for that assertion...)
That assertion is crucial. You cannot yield across a C call, because
there is no way to suspend the C stack. But you can modify lua_resume
in a way similar to lua_pcall, so that it receives an extra argument
with an error handler.
-- Roberto