From: ShadowNinja Date: Sat, 30 Nov 2013 17:24:54 +0000 (-0500) Subject: Add error handler to async step X-Git-Tag: 0.4.9~69 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4696c59a5f3ad5884d57c7848207c39950f7052e;p=oweals%2Fminetest.git Add error handler to async step --- diff --git a/src/script/lua_api/l_async_events.cpp b/src/script/lua_api/l_async_events.cpp index 63ca87aed..8cd835688 100644 --- a/src/script/lua_api/l_async_events.cpp +++ b/src/script/lua_api/l_async_events.cpp @@ -29,36 +29,7 @@ int luaopen_marshal(lua_State *L); #include "log.h" #include "filesys.h" #include "porting.h" - -//TODO replace by ShadowNinja version not yet merged to master -static int script_error_handler(lua_State *L) { - lua_getfield(L, LUA_GLOBALSINDEX, "debug"); - if (!lua_istable(L, -1)) { - lua_pop(L, 1); - return 1; - } - lua_getfield(L, -1, "traceback"); - if (!lua_isfunction(L, -1)) { - lua_pop(L, 2); - return 1; - } - lua_pushvalue(L, 1); - lua_pushinteger(L, 2); - lua_call(L, 2, 1); - return 1; -} - -/******************************************************************************/ -static void scriptError(const char *fmt, ...) -{ - va_list argp; - va_start(argp, fmt); - char buf[10000]; - vsnprintf(buf, 10000, fmt, argp); - va_end(argp); - errorstream<<"ERROR: "<