From 4696c59a5f3ad5884d57c7848207c39950f7052e Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Sat, 30 Nov 2013 12:24:54 -0500 Subject: Add error handler to async step --- src/script/lua_api/l_async_events.cpp | 52 ++++++++--------------------------- 1 file changed, 11 insertions(+), 41 deletions(-) (limited to 'src') 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: "<