return 0;
}
#endif
+
+#if LUA_VERSION_NUM < 504
+# undef lua_resume
+int lua_resume_compat(lua_State *L, lua_State *from, int nargs, int *nresults)
+{
+ *nresults = 1;
+ return lua_resume(L, from, nargs);
+}
+#endif
lua_Integer lua_tointegerx(lua_State *L, int idx, int *isnum_r);
#endif
+#if LUA_VERSION_NUM < 504
+/*
+ * lua_resume() compatibility function. Lua 5.4 expects an extra "nresults"
+ * argeument.
+ */
+# define lua_resume(L, from, nargs, nresults) \
+ lua_resume_compat(L, from, nargs, nresults)
+int lua_resume_compat(lua_State *L, lua_State *from, int nargs, int *nresults);
+#endif
+
#endif
static void dlua_pcall_yieldable_continue(lua_State *L)
{
struct timeout *to;
- int nargs;
+ int nargs, nresults;
int ret;
nargs = dlua_tls_get_int(L, RESUME_NARGS);
dlua_tls_clear(L, RESUME_TIMEOUT);
dlua_tls_clear(L, RESUME_NARGS);
- ret = lua_resume(L, L, nargs);
+ ret = lua_resume(L, L, nargs, &nresults);
if (ret == LUA_YIELD) {
/*
* thread yielded - nothing to do
{
struct dlua_pcall_resume_state *state;
int ret;
+ int nresults;
i_assert(lua_status(L) == LUA_OK);
lua_insert(L, -(nargs + 1));
/* stack: func, args (top) */
- ret = lua_resume(L, L, nargs);
+ ret = lua_resume(L, L, nargs, &nresults);
if (ret == LUA_YIELD) {
/*
* thread yielded - nothing to do