aboutsummaryrefslogtreecommitdiff
path: root/luarocks.exe.c.51.patch
diff options
context:
space:
mode:
Diffstat (limited to 'luarocks.exe.c.51.patch')
-rw-r--r--luarocks.exe.c.51.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/luarocks.exe.c.51.patch b/luarocks.exe.c.51.patch
new file mode 100644
index 0000000..a8c022f
--- /dev/null
+++ b/luarocks.exe.c.51.patch
@@ -0,0 +1,47 @@
1--- luarocks.exe.c 2024-09-23 15:25:00.870448000 -0500
2+++ luarocks.exe.c 2024-09-23 15:27:52.663551300 -0500
3@@ -17,6 +17,33 @@
4 #define getprogname()
5 #endif
6
7+/* LUA_OK defined in lua 5.2+ */
8+#ifndef LUA_OK
9+#define LUA_OK 0
10+#endif
11+
12+/* luaL_traceback() introduced in lua 5.2 */
13+#ifndef luaL_traceback
14+static inline void
15+luaL_traceback(lua_State *L, lua_State *L1, const char *msg, int level){
16+ lua_getfield(L, LUA_GLOBALSINDEX, "debug");
17+ if(!lua_istable(L,-1)){
18+ lua_pop(L,1);
19+ return;
20+ }
21+ lua_getfield(L, -1, "traceback");
22+ if(!lua_isfunction(L,-1)){
23+ lua_pop(L,2);
24+ return;
25+ }
26+ lua_pushthread(L1);
27+ lua_pushstring(L,msg);
28+ lua_pushnumber(L,level);
29+ lua_call(L,3,1);
30+ return;
31+}
32+#endif
33+
34 static int registry_key;
35
36 /* fatal error, from srlua */
37@@ -38282,7 +38309,9 @@
38 lua_pop(L, 1);
39 lua_getfield(L, -1, "loaders"); /* table table.insert package package.loaders */
40 }
41- lua_copy(L, 4, 3); /* table table.insert package.searchers */
42+ /* lua_copy introduced in lua 5.2 */
43+ lua_replace(L,3);
44+ //lua_copy(L, 4, 3); /* table table.insert package.searchers */
45 lua_settop(L, 3); /* table table.insert package.searchers */
46 lua_pushnumber(L, 1); /* table table.insert package.searchers 1 */
47 lua_pushcfunction(L, pkg_loader); /* table table.insert package.searchers 1 pkg_loader */