Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix redefinition of luaL_setfuncs() #1

Closed
wants to merge 1 commit into from
Closed
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: 5 additions & 3 deletions src/lxplib.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ static void set_info (lua_State *L) {
/*
** Adapted from Lua 5.2.0
*/
static void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
static void compat_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 */
int i;
Expand All @@ -602,6 +602,8 @@ static void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
}
lua_pop(L, nup); /* remove upvalues */
}
#else
#define compat_luaL_setfuncs(L, reg, nup) luaL_setfuncs(L, reg, nup)
#endif


Expand All @@ -612,11 +614,11 @@ int luaopen_lxp (lua_State *L) {
lua_pushvalue(L, -2);
lua_rawset(L, -3);

luaL_setfuncs (L, lxp_meths, 0);
compat_luaL_setfuncs (L, lxp_meths, 0);
lua_pop (L, 1); /* remove metatable */

lua_newtable (L);
luaL_setfuncs (L, lxp_funcs, 0);
compat_luaL_setfuncs (L, lxp_funcs, 0);
set_info (L);
return 1;
}