[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: customizable Lua "panic" behavior
- From: "Eric Ries" <eries@...>
- Date: Mon, 19 Nov 2001 19:31:46 -0800
> -----Original Message-----
> From: firstname.lastname@example.org
> [mailto:email@example.com]On Behalf Of Edgar Toernig
> Sent: Monday, November 19, 2001 6:21 PM
> To: Multiple recipients of list
> Subject: Re: customizable Lua "panic" behavior
> Well, then say how you want to deal with it! You _have_ to set up some
> wrapper that catches the error and (at least) restores the C stack!
I want to be able to call my own C function, that has the same properties as
exit (cleans up, handles the error) but does not have the nasty side-effect
of exiting my process. I'm imagining something like this:
int defaultExitImpl( lua_State * L )
exit( 1 );
... during lua_open ..
L->exitFunc = defaultExitImpl
Now, we add a function like lua_setexithandler( lua_State *, lua_Cfunction )
to which I can pass my own exit handler. Let's imagine this was stored as
part of lua_State as "exitFunc"
so now, where ldo.c currently calls exit() it can now call
Does that make sense?