Revert "Improve handling of errors in lua functions and speed up calls. (#1427)"

This reverts commit f10e3ae36a.

(it was a joke PR, do not fear)
This commit is contained in:
Colby Klein
2017-04-04 17:21:55 -07:00
parent f10e3ae36a
commit b4e02821e8
21 changed files with 86 additions and 38 deletions
+10 -5
View File
@@ -458,7 +458,8 @@ static bool ValidateFromLua( const RString &sAnswer, RString &sErrorOut )
bool valid= false;
if(LuaHelpers::RunScriptOnStack(L, 2, 2))
RString error= "Lua error in ScreenTextEntry Validate: ";
if(LuaHelpers::RunScriptOnStack(L, error, 2, 2, true))
{
if(!lua_isstring(L, -1) || !lua_isboolean(L, -2))
{
@@ -491,7 +492,8 @@ static void OnOKFromLua( const RString &sAnswer )
g_OnOKFunc.PushSelf( L );
// Argument 1 (answer):
lua_pushstring( L, sAnswer );
LuaHelpers::RunScriptOnStack(L, 1, 0);
RString error= "Lua error in ScreenTextEntry OnOK: ";
LuaHelpers::RunScriptOnStack(L, error, 1, 0, true);
LUA->Release(L);
}
@@ -505,7 +507,8 @@ static void OnCancelFromLua()
Lua *L = LUA->Get();
g_OnCancelFunc.PushSelf( L );
LuaHelpers::RunScriptOnStack(L, 0, 0);
RString error= "Lua error in ScreenTextEntry OnCancel: ";
LuaHelpers::RunScriptOnStack(L, error, 0, 0, true);
LUA->Release(L);
}
@@ -528,7 +531,8 @@ static bool ValidateAppendFromLua( const RString &sAnswerBeforeChar, RString &sA
bool append= false;
if(LuaHelpers::RunScriptOnStack(L, 2, 1))
RString error= "Lua error in ScreenTextEntry ValidateAppend: ";
if(LuaHelpers::RunScriptOnStack(L, error, 2, 1, true))
{
if( !lua_isboolean(L, -1) )
{
@@ -557,7 +561,8 @@ static RString FormatAnswerForDisplayFromLua( const RString &sAnswer )
lua_pushstring( L, sAnswer );
RString answer;
if(LuaHelpers::RunScriptOnStack(L, 1, 1))
RString error= "Lua error in ScreenTextEntry FormatAnswerForDisplay: ";
if(LuaHelpers::RunScriptOnStack(L, error, 1, 1, true))
{
if( !lua_isstring(L, -1) )
{