lua-users home
lua-l archive

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


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.