From b23217d8403696cba514d1e0ca61d5bf61e8c536 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Mon, 25 Jul 2011 12:52:46 +0000 Subject: [PATCH] Script: Fixed Lua crash on refresh when Update() in the script has an error. --- Library/lua/LuaScript.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/lua/LuaScript.cpp b/Library/lua/LuaScript.cpp index 0b0d12fd..fd628822 100644 --- a/Library/lua/LuaScript.cpp +++ b/Library/lua/LuaScript.cpp @@ -165,6 +165,7 @@ bool LuaScript::RunFunctionWithReturn(const char* funcName, double& numValue, st if (lua_pcall(m_State, 0, 1, 0)) { LuaManager::ReportErrors(m_State); + lua_pop(m_State, 1); } else { @@ -181,9 +182,9 @@ bool LuaScript::RunFunctionWithReturn(const char* funcName, double& numValue, st ret = true; } - } - lua_pop(m_State, 2); + lua_pop(m_State, 2); + } } return ret;