lua-users home
lua-l archive

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


On Fri, Oct 26, 2007 at 01:55:48PM +0200, Colin wrote:
> On Thu, Oct 25, 2007 at 07:13:07PM -0500, James Porter wrote:
> > Here is the aforementioned patch to extend Lua 5.1.2's 
> > exception-handling capabilities. I know Colin in particular expressed 
> > interest, though others would probably find it useful as well. It should 
> > simplify any C++ code bound to Lua, as well as making lua_call a safer 
> > proposition (it throws an exception rather than panicking and exiting). 
> > There's more information in the provided README, as well as in my 
> > previous message.
> 
> AFACIS this patch takes care of the easy part, i.e. lets error be always
> thrown as exceptions, but does not take care of the hard part, i.e. make
> sure that all necessary cleanup is performed in the wake of an exception.
> 
> For example, the Lua state's nCcalls variable surely must be reset before
> throwing an exception that is not caught by a Lua protected call...at
> least if the lua_State is to be ever used again.

Actually the manual is very clear: A state that has called the panic
function may not be used again (I had grepped for the wrong words before
writing the other mail, sorry)!

In other words, this patch does not enable correct fly-through of
exceptions (and I assume that no amount of resetstack() can ever
fix this...).

Back to square one.

Regards, Colin