diff --git a/src/l52util.c b/src/l52util.c index 6373687..4883a9e 100644 --- a/src/l52util.c +++ b/src/l52util.c @@ -13,6 +13,7 @@ #include #include /* for memset */ #include +#include /* for LUAJIT_VERSION: LuaJIT already provides luaL_setfuncs */ #if LUA_VERSION_NUM >= 502 @@ -31,8 +32,12 @@ void luaL_register (lua_State *L, const char *libname, const luaL_Reg *l){ #endif -#else +#else +#ifndef LUAJIT_VERSION +/* LuaJIT's own lib_aux.c already provides luaL_setfuncs (declared in + * lauxlib.h); defining it again here would collide at link time when + * LuaJIT is linked as a static library. Only needed for vanilla Lua 5.1. */ void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup){ luaL_checkstack(L, nup, "too many upvalues"); for (; l->name != NULL; l++) { /* fill the table with given functions */ @@ -44,6 +49,7 @@ void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup){ } lua_pop(L, nup); /* remove upvalues */ } +#endif void lua_rawgetp(lua_State *L, int index, const void *p){ index = lua_absindex(L, index);