[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua_atpanic with class method
- From: Coda Highland <chighland@...>
- Date: Sun, 2 Dec 2012 19:05:15 -0800
On Sun, Dec 2, 2012 at 4:46 PM, Philipp Kraus
<philipp.kraus@flashpixx.de> wrote:
> Hello,
>
> I would like to write a panic function, that throws an exception if a panic is occured.
> Which signature must set for the method mypanic( lua_state* ) ?
> How can I call a private class method on the lua_panic function?
>
> Thanks
>
> Phil
You can't.
You can only pass a C function (or a C++ "static" function) as a panic
handler. If you want to map that to an instance method, you'll need to
map the Lua state to a pointer to the instance (a global pointer
variable suffices if you only have one Lua state) and invoke the
method from within the panic handler.
/s/ Adam