Improved error checking (and flood protection)

Signed-off-by: Warmist <Warmist@gmail.com>
develop
Warmist 2011-07-16 22:23:44 +03:00
parent e47d05eeb4
commit fc68387ea3
1 changed files with 8 additions and 2 deletions

@ -56,8 +56,15 @@ DFhackCExport command_result plugin_onupdate ( Core * c )
s.getglobal("OnTick"); s.getglobal("OnTick");
if(s.is<lua::function>()) if(s.is<lua::function>())
{ {
try{
s.pcall(); s.pcall();
} }
catch(lua::exception &e)
{
c->con.printerr("Error OnTick:%s\n",e.what());
c->con.msleep(1000);
}
}
s.settop(0); s.settop(0);
SDL_mutexV(mymutex); SDL_mutexV(mymutex);
return CR_OK; return CR_OK;
@ -74,7 +81,6 @@ DFhackCExport command_result dfusion (Core * c, vector <string> & parameters)
try{ try{
s.loadfile("dfusion/init.lua"); //load script s.loadfile("dfusion/init.lua"); //load script
s.pcall(0,0);// run it s.pcall(0,0);// run it
} }
catch(lua::exception &e) catch(lua::exception &e)
{ {