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:
+5
-6
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user