summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Pioch <lukas@zgow.de>2017-04-16 11:41:40 +0200
committerLukas Pioch <lukas@zgow.de>2017-04-22 09:29:13 +0200
commit76bf5d770c4a34ca34b14eef15ab76e4215f1521 (patch)
treed2c3da3a4197398772600b9edf7102f0b9c17ebd /src
parentAPIDoc: Corrected a few links (diff)
downloadcuberite-callbacks.tar
cuberite-callbacks.tar.gz
cuberite-callbacks.tar.bz2
cuberite-callbacks.tar.lz
cuberite-callbacks.tar.xz
cuberite-callbacks.tar.zst
cuberite-callbacks.zip
Diffstat (limited to 'src')
-rw-r--r--src/Bindings/ManualBindings.cpp16
-rw-r--r--src/Bindings/ManualBindings.h67
-rw-r--r--src/Bindings/ManualBindings_World.cpp8
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;
}
);