Replaced every use of lua_call with RunScriptOnStack. Modified RunScriptOnStack to report an error to log and system message using a passed in context string. Modified every use of RunScriptOnStack to avoid crashing so that the reported error can be seen.

This commit is contained in:
Kyzentun
2014-07-05 01:34:05 -06:00
parent e9220c56b7
commit a7a98a690e
18 changed files with 219 additions and 168 deletions
+5 -6
View File
@@ -268,12 +268,11 @@ bool ActorUtil::LoadTableFromStackShowErrors( Lua *L )
lua_pushvalue( L, -1 );
func.SetFromStack( L );
RString sError;
if( !LuaHelpers::RunScriptOnStack(L, sError, 0, 1) )
RString Error= "Lua runtime error: ";
if( !LuaHelpers::RunScriptOnStack(L, Error, 0, 1, true) )
{
lua_pop( L, 1 );
sError = ssprintf( "Lua runtime error: %s", sError.c_str() );
Dialog::OK( sError, "LUA_ERROR" );
Dialog::OK( Error, "LUA_ERROR" );
return false;
}
@@ -285,9 +284,9 @@ bool ActorUtil::LoadTableFromStackShowErrors( Lua *L )
lua_Debug debug;
lua_getinfo( L, ">nS", &debug );
sError = ssprintf( "%s: must return a table", debug.short_src );
Error = ssprintf( "%s: must return a table", debug.short_src );
Dialog::OK( sError, "LUA_ERROR" );
Dialog::OK( Error, "LUA_ERROR" );
return false;
}
return true;