summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/scripting/luascript.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/scripting/luascript.cpp b/src/scripting/luascript.cpp
index 42a78955..06fbd2ab 100644
--- a/src/scripting/luascript.cpp
+++ b/src/scripting/luascript.cpp
@@ -159,18 +159,23 @@ bool LuaScript::resume()
nbArgs = -1;
#if LUA_VERSION_NUM < 502
int result = lua_resume(mCurrentState, tmpNbArgs);
-#else
+ int nresults = lua_gettop(mCurrentState);
+#elif LUA_VERSION_NUM < 504
int result = lua_resume(mCurrentState, nullptr, tmpNbArgs);
+ int nresults = lua_gettop(mCurrentState);
+#else
+ int nresults = 0;
+ int result = lua_resume(mCurrentState, nullptr, tmpNbArgs, &nresults);
#endif
if (result == 0) // Thread is done
{
- if (lua_gettop(mCurrentState) > 0)
+ if (nresults > 0)
LOG_WARN("Ignoring values returned by script thread!");
}
else if (result == LUA_YIELD) // Thread has yielded
{
- if (lua_gettop(mCurrentState) > 0)
+ if (nresults > 0)
LOG_WARN("Ignoring values passed to yield!");
}
else // Thread encountered an error
@@ -195,7 +200,7 @@ bool LuaScript::resume()
delete mCurrentThread;
}
- mCurrentThread = 0;
+ mCurrentThread = nullptr;
mCurrentState = mRootState;
return done;