summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaState.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-02-04 10:29:10 +0100
committermadmaxoft <github@xoft.cz>2014-02-04 10:29:10 +0100
commit69c85e5169e5322857d2dfbfccd45281ca1be1c4 (patch)
tree9aa60fc5c0804e878816cc182ea14dfa0c363610 /src/Bindings/LuaState.cpp
parentImproved error resistance in cPluginManager:CallPlugin(). (diff)
downloadcuberite-69c85e5169e5322857d2dfbfccd45281ca1be1c4.tar
cuberite-69c85e5169e5322857d2dfbfccd45281ca1be1c4.tar.gz
cuberite-69c85e5169e5322857d2dfbfccd45281ca1be1c4.tar.bz2
cuberite-69c85e5169e5322857d2dfbfccd45281ca1be1c4.tar.lz
cuberite-69c85e5169e5322857d2dfbfccd45281ca1be1c4.tar.xz
cuberite-69c85e5169e5322857d2dfbfccd45281ca1be1c4.tar.zst
cuberite-69c85e5169e5322857d2dfbfccd45281ca1be1c4.zip
Diffstat (limited to '')
-rw-r--r--src/Bindings/LuaState.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index 6a02197e8..0a3f6f5b7 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -1072,7 +1072,8 @@ int cLuaState::CallFunctionWithForeignParams(
}
// Call the function, with an error handler:
- int s = lua_pcall(m_LuaState, a_SrcParamEnd - a_SrcParamStart + 1, LUA_MULTRET, OldTop);
+ LogStack("Before pcall");
+ int s = lua_pcall(m_LuaState, a_SrcParamEnd - a_SrcParamStart + 1, LUA_MULTRET, OldTop + 1);
if (ReportErrors(s))
{
LOGWARN("Error while calling function '%s' in '%s'", a_FunctionName.c_str(), m_SubsystemName.c_str());
@@ -1088,7 +1089,9 @@ int cLuaState::CallFunctionWithForeignParams(
m_NumCurrentFunctionArgs = -1;
m_CurrentFunctionName.clear();
- return -1;
+ // Make Lua think everything is okay and return 0 values, so that plugins continue executing.
+ // The failure is indicated by the zero return values.
+ return 0;
}
// Reset the internal checking mechanisms: