[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua_dofile and _ALERT, 5.0a compatibility
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 1 Nov 2002 11:59:59 -0300
>Yes, this is a bug in 5.0a. It will be corrected for 5.0 beta.
Here is the correct code:
static void callalert (lua_State *L, int status) {
if (status != 0) {
lua_getglobal(L, "_ALERT");
if (lua_isfunction(L, -1)) {
lua_insert(L, -2);
lua_call(L, 1, 0);
}
else { /* no _ALERT function; print it on stderr */
fprintf(stderr, "%s\n", lua_tostring(L, -2));
lua_pop(L, 2); /* remove error message and _ALERT */
}
}
}
--lhf