system/luaserver: Terminate Lua script when luaclient dies.

Origin commit data
------------------
Commit: ffec667030
Author: martii <m4rtii@gmx.de>
Date: 2014-10-13 (Mon, 13 Oct 2014)
This commit is contained in:
martii
2014-10-13 22:11:25 +02:00
committed by vanhofen
parent 4a5c4158c6
commit 35fcbc3447
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 },