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