Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/l52util.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <memory.h>
#include <string.h> /* for memset */
#include <assert.h>
#include <luajit.h> /* for LUAJIT_VERSION: LuaJIT already provides luaL_setfuncs */

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will error if LuaJIT is not available, breaking builds with mainline Lua.


#if LUA_VERSION_NUM >= 502

Expand All @@ -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 */
Expand All @@ -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);
Expand Down