--- 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 */