aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 0524125e..5e55ddac 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.87 2002/10/04 14:31:40 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.88 2002/10/16 20:41:35 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -422,9 +422,14 @@ LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size,
422static void callalert (lua_State *L, int status) { 422static void callalert (lua_State *L, int status) {
423 if (status != 0) { 423 if (status != 0) {
424 lua_getglobal(L, "_ALERT"); 424 lua_getglobal(L, "_ALERT");
425 lua_insert(L, -2); 425 if (lua_isfunction(L, -1)) {
426 lua_call(L, 1, 0); 426 lua_insert(L, -2);
427 lua_pop(L, 1); 427 lua_call(L, 1, 0);
428 }
429 else { /* no _ALERT function; print it on stderr */
430 fprintf(stderr, "%s\n", lua_tostring(L, -2));
431 lua_pop(L, 2); /* remove error message and _ALERT */
432 }
428 } 433 }
429} 434}
430 435