diff --git a/src/gui/lua/luainstance.cpp b/src/gui/lua/luainstance.cpp index 47dc626ad..4df60cc91 100644 --- a/src/gui/lua/luainstance.cpp +++ b/src/gui/lua/luainstance.cpp @@ -473,6 +473,7 @@ const char CLuaInstance::className[] = LUA_CLASSNAME; CLuaInstance::CLuaInstance() { + DisableAbort = true; /* Create the intepreter object. */ lua = luaL_newstate(); @@ -523,7 +524,12 @@ void CLuaInstance::runScript(const char *fileName, std::vector *arg lua_rawseti(lua, -2, n++); if (argv && (!argv->empty())) { + std::string abort = "DisableAbort"; for(std::vector::iterator it = argv->begin(); it != argv->end(); ++it) { + if (!it->compare(abort)) { + DisableAbort = false; + continue; + } lua_pushstring(lua, it->c_str()); lua_rawseti(lua, -2, n++); } @@ -592,7 +598,11 @@ static void abortHook(lua_State *lua, lua_Debug *) void CLuaInstance::abortScript() { - lua_sethook(lua, &abortHook, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); + if(DisableAbort) + lua_sethook(lua, &abortHook, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); + else + fprintf(stderr, "DisableAbort Script is aktiv\n"); + } #ifdef STATIC_LUAPOSIX diff --git a/src/gui/lua/luainstance.h b/src/gui/lua/luainstance.h index fe0ad3bff..a7249eb07 100644 --- a/src/gui/lua/luainstance.h +++ b/src/gui/lua/luainstance.h @@ -42,7 +42,7 @@ public: ~CLuaInstance(); void runScript(const char *fileName, std::vector *argv = NULL, std::string *result_code = NULL, std::string *result_string = NULL, std::string *error_string = NULL); void abortScript(); - + bool DisableAbort; enum { DYNFONT_NO_ERROR = 0, DYNFONT_MAXIMUM_FONTS = 1,