diff options
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 16 | ||||
-rw-r--r-- | src/Bindings/ManualBindings.h | 67 | ||||
-rw-r--r-- | src/Bindings/ManualBindings_World.cpp | 8 |
3 files changed, 64 insertions, 27 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 34357eb65..dadfdba82 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -1237,8 +1237,12 @@ static int tolua_cPluginManager_ForEachCommand(lua_State * tolua_S) { UNUSED(a_Plugin); bool ret = false; - m_LuaState.Call(m_FnRef, a_Command, a_Permission, a_HelpString, cLuaState::Return, ret); - return ret; + if (m_LuaState.Call(m_FnRef, a_Command, a_Permission, a_HelpString, cLuaState::Return, ret)) + { + return ret; + } + // An error occurred + return true; } cLuaState & m_LuaState; cLuaState::cRef & m_FnRef; @@ -1296,8 +1300,12 @@ static int tolua_cPluginManager_ForEachConsoleCommand(lua_State * tolua_S) UNUSED(a_Plugin); UNUSED(a_Permission); bool ret = false; - m_LuaState.Call(m_FnRef, a_Command, a_HelpString, cLuaState::Return, ret); - return ret; + if (m_LuaState.Call(m_FnRef, a_Command, a_HelpString, cLuaState::Return, ret)) + { + return ret; + } + // An error occurred + return true; } cLuaState & m_LuaState; cLuaState::cRef & m_FnRef; diff --git a/src/Bindings/ManualBindings.h b/src/Bindings/ManualBindings.h index 98e3e88ef..ccd027fc1 100644 --- a/src/Bindings/ManualBindings.h +++ b/src/Bindings/ManualBindings.h @@ -13,7 +13,6 @@ - // fwd: struct tolua_Error; @@ -98,8 +97,12 @@ public: virtual bool Item(Ty2 * a_Item) override { bool ret = false; - m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, ret); - return ret; + if (m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, ret)) + { + return ret; + } + // An error occurred + return true; } cLuaState & m_LuaState; cLuaState::cRef & m_FnRef; @@ -161,8 +164,12 @@ public: virtual bool Item(Ty2 * a_Item) override { bool ret = false; - m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, ret); - return ret; + if (m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, ret)) + { + return ret; + } + // An error occurred + return true; } cLuaState & m_LuaState; cLuaState::cRef & m_FnRef; @@ -224,8 +231,12 @@ public: virtual bool Item(Ty2 * a_Item) override { bool ret = false; - m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, ret); - return ret; + if (m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, ret)) + { + return ret; + } + // An error occurred + return true; } cLuaState & m_LuaState; cLuaState::cRef & m_FnRef; @@ -290,8 +301,12 @@ public: virtual bool Item(Ty2 * a_Item) override { bool ret = false; - m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, ret); - return ret; + if (m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, ret)) + { + return ret; + } + // An error occurred + return true; } cLuaState & m_LuaState; cLuaState::cRef & m_FnRef; @@ -355,8 +370,12 @@ public: virtual bool Item(Ty2 * a_Item) override { bool ret = false; - m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, ret); - return ret; + if (m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, ret)) + { + return ret; + } + // An error occurred + return true; } cLuaState & m_LuaState; cLuaState::cRef & m_FnRef; @@ -427,14 +446,12 @@ public: virtual bool Item(Ty2 * a_Item) override { bool res = false; - if (!m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, res)) + if (m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, res)) { - LOGWARNING("Failed to call Lua callback"); - m_LuaState.LogStackTrace(); - return true; // Abort enumeration + return res; } - - return res; + // An error occurred + return true; } } Callback(L, FnRef); @@ -495,8 +512,12 @@ public: virtual bool Item(Ty2 * a_Item) override { bool res = false; // By default continue the enumeration - m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, res); - return res; + if (m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, res)) + { + return res; + } + // An error occurred + return true; } } Callback(L, FnRef); @@ -553,8 +574,12 @@ public: virtual bool Item(Ty2 * a_Item) override { bool res = false; // By default continue the enumeration - m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, res); - return res; + if (m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, res)) + { + return res; + } + // An error occurred + return true; } } Callback(L, FnRef); diff --git a/src/Bindings/ManualBindings_World.cpp b/src/Bindings/ManualBindings_World.cpp index f24e5ac34..ce7558616 100644 --- a/src/Bindings/ManualBindings_World.cpp +++ b/src/Bindings/ManualBindings_World.cpp @@ -246,8 +246,12 @@ static int tolua_cWorld_ForEachLoadedChunk(lua_State * tolua_S) [&L, &FnRef](int a_ChunkX, int a_ChunkZ) -> bool { bool res = false; // By default continue the enumeration - L.Call(FnRef, a_ChunkX, a_ChunkZ, cLuaState::Return, res); - return res; + if (L.Call(FnRef, a_ChunkX, a_ChunkZ, cLuaState::Return, res)) + { + return res; + } + // An error occurred + return true; } ); |