[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: protected environments and errors
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 27 Aug 2003 10:06:35 -0300
> Is it safe to assume that the lua state is still consistent when a memory
> allocation error occurs inside a protected environment?
Yes.
> If so, is there some other reason why there should be different handling
> of either type of error? (aside from the optional errfunc not being called)
Yes. Although the state is consistent, you will not be able to do
much with it without extra memory. For instance, even a call to
lua_pushfstring (to format the error message) will probably fail.
> Does lua_resume() return the same error codes as lua_pcall()?
Yes.
> When lua_resume() has returned an error, should the thread be
> considered inconsistent or is it still possible to do a lua_loadbuffer
> or similar?
It should be consistent, but it is better not to assume this.
> If not, and error handling must be done after a failed resume, can a
> new thread (created with lua_newthread) access the global variables
> set during the execution of the defunct thread?
Sure.
-- Roberto