[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: try..catch in Lua
- From: "RJP Computing" <rjpcomputing@...>
- Date: Wed, 30 Jan 2008 09:44:47 -0500
On Jan 29, 2008 2:49 AM, James Porter <firstname.lastname@example.org
Hu Qiwei wrote:A while back, I made a patch to Lua to implement full C++ exception
> Traditional pcall() and xpcall() behavior is intact. You can nest
> pcall() and try..catch as you want.
> The difference is, you can call coroutine.yield() (or lua_yield in C)
> in try..catch block. The implementation
> is platform independent. It uses setjmp...longjmp mechanism so it may
> not be quite compatible with
handling, primarily to ensure that exceptions passing through the Lua
state don't put it in an inconsistent, well, state. At the time, I
designed it to catch std::exceptions in pcalls and turn them into Lua
errors, but I think it would be preferable to have try/catch available
for things like that.
I'm not sure how likely it is that my exception-handling changes will
get rolled into Lua proper, but I think these two patches would benefit
from being merged into a single, more thorough patch.
If there's interest, I'll post my patch again, though I want to make a
few small changes to it first.
I would be very interested in a combination patch. I use exceptions heavily and would love the support for this. Has the patch been tested on Windows, Linux and MacOSX?