system/luaserver: Terminate Lua script when luaclient dies.

This commit is contained in:
martii
2014-10-13 22:11:25 +02:00
committed by svenhoefer
parent d681936f26
commit ffec667030
4 changed files with 55 additions and 17 deletions

View File

@@ -480,6 +480,16 @@ void CLuaInstance::runScript(const char *fileName, const char *arg0, ...)
args.clear();
}
static void abortHook(lua_State *lua, lua_Debug *)
{
luaL_error(lua, "aborted");
}
void CLuaInstance::abortScript()
{
lua_sethook(lua, &abortHook, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
}
const luaL_Reg CLuaInstance::methods[] =
{
{ "PaintBox", CLuaInstance::PaintBox },