|
Mystro256 |
cdee62c |
# HG changeset patch
|
|
Mystro256 |
cdee62c |
# User Bart van Strien <bart.bes+projects@gmail.com>
|
|
Mystro256 |
cdee62c |
# Date 1525370656 -7200
|
|
Mystro256 |
cdee62c |
# Node ID 6724986f3935b8373319067e99400a681a18cfc3
|
|
Mystro256 |
cdee62c |
# Parent a95b5df234f888dcf751f3fb3a39783a7bb67b5f
|
|
Mystro256 |
cdee62c |
Restore lua 5.2/5.3 compatibility (fixes #1408)
|
|
Mystro256 |
cdee62c |
|
|
Mystro256 |
cdee62c |
diff --git a/src/common/runtime.cpp b/src/common/runtime.cpp
|
|
Mystro256 |
cdee62c |
--- a/src/common/runtime.cpp
|
|
Mystro256 |
cdee62c |
+++ b/src/common/runtime.cpp
|
|
Mystro256 |
cdee62c |
@@ -879,4 +879,13 @@
|
|
Mystro256 |
cdee62c |
return Type::byName(luaL_checkstring(L, idx));
|
|
Mystro256 |
cdee62c |
}
|
|
Mystro256 |
cdee62c |
|
|
Mystro256 |
cdee62c |
+int luax_resume(lua_State *L, int nargs)
|
|
Mystro256 |
cdee62c |
+{
|
|
Mystro256 |
cdee62c |
+#if LUA_VERSION_NUM >= 502
|
|
Mystro256 |
cdee62c |
+ return lua_resume(L, nullptr, nargs);
|
|
Mystro256 |
cdee62c |
+#else
|
|
Mystro256 |
cdee62c |
+ return lua_resume(L, nargs);
|
|
Mystro256 |
cdee62c |
+#endif
|
|
Mystro256 |
cdee62c |
+}
|
|
Mystro256 |
cdee62c |
+
|
|
Mystro256 |
cdee62c |
} // love
|
|
Mystro256 |
cdee62c |
diff --git a/src/common/runtime.h b/src/common/runtime.h
|
|
Mystro256 |
cdee62c |
--- a/src/common/runtime.h
|
|
Mystro256 |
cdee62c |
+++ b/src/common/runtime.h
|
|
Mystro256 |
cdee62c |
@@ -676,6 +676,11 @@
|
|
Mystro256 |
cdee62c |
return 0;
|
|
Mystro256 |
cdee62c |
}
|
|
Mystro256 |
cdee62c |
|
|
Mystro256 |
cdee62c |
+/**
|
|
Mystro256 |
cdee62c |
+ * Compatibility shim for lua_resume
|
|
Mystro256 |
cdee62c |
+ **/
|
|
Mystro256 |
cdee62c |
+int luax_resume(lua_State *L, int nargs);
|
|
Mystro256 |
cdee62c |
+
|
|
Mystro256 |
cdee62c |
} // love
|
|
Mystro256 |
cdee62c |
|
|
Mystro256 |
cdee62c |
#endif // LOVE_RUNTIME_H
|
|
Mystro256 |
cdee62c |
diff --git a/src/love.cpp b/src/love.cpp
|
|
Mystro256 |
cdee62c |
--- a/src/love.cpp
|
|
Mystro256 |
cdee62c |
+++ b/src/love.cpp
|
|
Mystro256 |
cdee62c |
@@ -19,6 +19,7 @@
|
|
Mystro256 |
cdee62c |
**/
|
|
Mystro256 |
cdee62c |
|
|
Mystro256 |
cdee62c |
#include "common/version.h"
|
|
Mystro256 |
cdee62c |
+#include "common/runtime.h"
|
|
Mystro256 |
cdee62c |
#include "modules/love/love.h"
|
|
Mystro256 |
cdee62c |
#include <SDL.h>
|
|
Mystro256 |
cdee62c |
|
|
Mystro256 |
cdee62c |
@@ -214,7 +215,7 @@
|
|
Mystro256 |
cdee62c |
lua_newthread(L);
|
|
Mystro256 |
cdee62c |
lua_pushvalue(L, -2);
|
|
Mystro256 |
cdee62c |
int stackpos = lua_gettop(L);
|
|
Mystro256 |
cdee62c |
- while (lua_resume(L, 0) == LUA_YIELD)
|
|
Mystro256 |
cdee62c |
+ while (love::luax_resume(L, 0) == LUA_YIELD)
|
|
Mystro256 |
cdee62c |
lua_pop(L, lua_gettop(L) - stackpos);
|
|
Mystro256 |
cdee62c |
|
|
Mystro256 |
cdee62c |
retval = 0;
|