lua-users home
lua-l archive

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

Do you handle the exception in the same function or someplace outside?

-----Original Message-----
From: [] On Behalf Of Patrick Donnelly
Sent: Thursday, October 02, 2008 11:49 AM
To: Lua list
Subject: Re: I need your help! C++ exception in coroutine Crashes.

On Thu, Oct 2, 2008 at 6:37 AM, Aidin Abedi <> wrote:
> Hello
> I've embedded lua and when I call a c++ function (that throws a c++
> exception) inside a coroutine my app crashes badly. Windows just says:
> "Runtime Error!
> This application has requested the Runtime to terminate it in an unusual way.
> Please contact the application's support team for more information."
> I do have a c++ exception-catch outside the pcall. There is no crash
> if I call the same function (that throws a exception) from inside
> lua's main-thread.
> This issue must have been detected before. Please help me!
> I appreciate any ideas. I thank you for your time.

It sounds to me like you did a generic lua_call in the main thread
(instead of lua_resume). When Lua catches the error, and no error
handler was set for that thread, it will exit the main application.
You should implement a panic handler to check if this is the case.


-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