[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why is the stack cleared on panic?
- From: Alexander Gladysh <agladysh@...>
- Date: Mon, 10 Jan 2011 19:29:52 +0300
On Mon, Jan 10, 2011 at 18:50, Julio Merino <jmmv84@gmail.com> wrote:
> static jmp_buf buf;
> int panic_handler(lua_State* s)
> {
> longjmp(buf, 1);
> }
> void safe_gettable(lua_State* s, const int index)
> {
> if (setjmp(buf) == 0)
> lua_gettable(s, index);
> else
> throw error('Uh oh, lua_gettable failed');
> }
Um. This looks like you intend to work from C++ with Lua, compiled as C.
In general, this is not a good idea.
Alexander.