[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Why is the stack cleared on panic?
- From: Julio Merino <jmmv84@...>
- Date: Mon, 10 Jan 2011 16:37:25 +0000
On Mon, Jan 10, 2011 at 4:29 PM, Alexander Gladysh <email@example.com> wrote:
> On Mon, Jan 10, 2011 at 18:50, Julio Merino <firstname.lastname@example.org> 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);
>> 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.
Yep, I found that the hard way. That said I'd prefer the ability to
use prebuilt Lua libraries shipped as binary packages (for your
preferred distro). Is that a bad idea in general too? (Maybe yes
based on the amount of settings in luaconf.h... but I'm very new