lua-users home
lua-l archive

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

On 9/27/07, Senko, Michael <> wrote:
> The problem I have is with error handling.  I catch syntax errors just fine
> with the return value from luaL_loadbuffer().  Its execution errors that I
> have trouble with. Based upon PIL, I would expect errors to cause
> lua_resume() to return an error code in the same fashion as lua_pcall().
> What I'm seeing instead is that I get a panic ("unprotected error in call to
> Lua API") which halts my application.

According to the manual, lua_resume() does return an error code:

What I believe what happened was you tried to resume the coroutine
when there was an error previously. Perhaps you need to check if there
was an error, and if there was, print the value at the top of the
stack (the error message). Review:

for more on error messages.


-Patrick Donnelly

"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."

-Will Durant