lua-users home
lua-l archive

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

> Is it safe to assume that the lua state is still consistent when a memory
> allocation error occurs inside a protected environment?


> 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()?


> 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?


-- Roberto