make love lua 5.4 conform

This commit is contained in:
niki
2020-08-14 19:27:42 +02:00
parent 5f4d2f3323
commit 99e1c0034d
5 changed files with 19 additions and 6 deletions
+4 -2
View File
@@ -963,9 +963,11 @@ Type *luax_type(lua_State *L, int idx)
return Type::byName(luaL_checkstring(L, idx));
}
int luax_resume(lua_State *L, int nargs)
int luax_resume(lua_State *L, int nargs, int* nres)
{
#if LUA_VERSION_NUM >= 502
#if LUA_VERSION_NUM >= 504
return lua_resume(L, nullptr, nargs, nres);
#elif LUA_VERSION_NUM >= 502
return lua_resume(L, nullptr, nargs);
#else
return lua_resume(L, nargs);
+1 -1
View File
@@ -701,7 +701,7 @@ int luax_catchexcept(lua_State *L, const T& func, const F& finallyfunc)
* Compatibility shim for lua_resume
* Exported because it's used in the launcher
**/
LOVE_EXPORT int luax_resume(lua_State *L, int nargs);
LOVE_EXPORT int luax_resume(lua_State *L, int nargs, int* nres);
} // love
+3 -1
View File
@@ -73,7 +73,9 @@
typedef size_t lua_Unsigned;
#endif
#if LUA_VERSION_NUM == 501
#if LUA_VERSION_NUM >= 504
# define LUAL_BUFFER53_BUFFER(B) (B)->b.b
#elif LUA_VERSION_NUM == 501
# define LUAL_BUFFER53_BUFFER(B) (B)->b.buffer
#else
# define LUAL_BUFFER53_BUFFER(B) (B)->b.initb
+5 -1
View File
@@ -309,8 +309,12 @@ int luaopen_luautf8 (lua_State *L) {
lua_setfield(L, -2, l->name);
}
}
#if LUA_VERSION_NUM >= 504
lua_pushlstring(L, UTF8PATT, sizeof(UTF8PATT) / sizeof(char) - 1);
lua_setfield(L, -2, "charpattern");
#else
lua_pushliteral(L, UTF8PATT);
lua_setfield(L, -2, "charpattern");
#endif
return 1;
}
+6 -1
View File
@@ -215,8 +215,13 @@ static DoneAction runlove(int argc, char **argv, int &retval)
lua_newthread(L);
lua_pushvalue(L, -2);
int stackpos = lua_gettop(L);
while (love::luax_resume(L, 0) == LUA_YIELD)
int nres;
while (love::luax_resume(L, 0, &nres) == LUA_YIELD)
#if LUA_VERSION_NUM >= 504
lua_pop(L, nres);
#else
lua_pop(L, lua_gettop(L) - stackpos);
#endif
retval = 0;
DoneAction done = DONE_QUIT;