Skip to content

Commit 7780a20

Browse files
brammooldouglaskayama
authored andcommitted
patch 7.4.763 Problem: Building with Lua 5.1 doesn't work. Solution: Define lua_replace and lua_remove. (KF Leong)
1 parent cabe434 commit 7780a20

2 files changed

Lines changed: 25 additions & 16 deletions

File tree

src/if_lua.c

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,25 +111,27 @@ static luaV_Dict *luaV_pushdict (lua_State *L, dict_T *dic);
111111
#define lua_tointeger dll_lua_tointeger
112112
#define lua_call dll_lua_call
113113
#define lua_pcall dll_lua_pcall
114-
115-
#elif LUA_VERSION_NUM <= 502
116-
#define lua_replace dll_lua_replace
117-
#define lua_remove dll_lua_remove
118114
#else
119-
#define lua_rotate dll_lua_rotate
120115
#define lua_tonumberx dll_lua_tonumberx
121116
#define lua_tointegerx dll_lua_tointegerx
122117
#define lua_callk dll_lua_callk
123118
#define lua_pcallk dll_lua_pcallk
124119
#define lua_getglobal dll_lua_getglobal
125120
#define lua_setglobal dll_lua_setglobal
126121
#endif
122+
#if LUA_VERSION_NUM <= 502
123+
#define lua_replace dll_lua_replace
124+
#define lua_remove dll_lua_remove
125+
#endif
126+
#if LUA_VERSION_NUM >= 503
127+
#define lua_rotate dll_lua_rotate
128+
#define lua_copy dll_lua_copy
129+
#endif
127130
#define lua_typename dll_lua_typename
128131
#define lua_close dll_lua_close
129132
#define lua_gettop dll_lua_gettop
130133
#define lua_settop dll_lua_settop
131134
#define lua_pushvalue dll_lua_pushvalue
132-
#define lua_copy dll_lua_copy
133135
#define lua_isnumber dll_lua_isnumber
134136
#define lua_isstring dll_lua_isstring
135137
#define lua_type dll_lua_type
@@ -199,12 +201,7 @@ lua_Number (*dll_lua_tonumber) (lua_State *L, int idx);
199201
lua_Integer (*dll_lua_tointeger) (lua_State *L, int idx);
200202
void (*dll_lua_call) (lua_State *L, int nargs, int nresults);
201203
int (*dll_lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);
202-
#elif LUA_VERSION_NUM <= 502
203-
void (*dll_lua_replace) (lua_State *L, int idx);
204-
void (*dll_lua_remove) (lua_State *L, int idx);
205204
#else
206-
207-
void (*dll_lua_rotate) (lua_State *L, int idx, int n);
208205
lua_Number (*dll_lua_tonumberx) (lua_State *L, int idx, int *isnum);
209206
lua_Integer (*dll_lua_tointegerx) (lua_State *L, int idx, int *isnum);
210207
void (*dll_lua_callk) (lua_State *L, int nargs, int nresults, int ctx,
@@ -213,6 +210,13 @@ int (*dll_lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc,
213210
int ctx, lua_CFunction k);
214211
void (*dll_lua_getglobal) (lua_State *L, const char *var);
215212
void (*dll_lua_setglobal) (lua_State *L, const char *var);
213+
#endif
214+
#if LUA_VERSION_NUM <= 502
215+
void (*dll_lua_replace) (lua_State *L, int idx);
216+
void (*dll_lua_remove) (lua_State *L, int idx);
217+
#endif
218+
#if LUA_VERSION_NUM >= 503
219+
void (*dll_lua_rotate) (lua_State *L, int idx, int n);
216220
void (*dll_lua_copy) (lua_State *L, int fromidx, int toidx);
217221
#endif
218222
const char *(*dll_lua_typename) (lua_State *L, int tp);
@@ -296,18 +300,21 @@ static const luaV_Reg luaV_dll[] = {
296300
{"lua_tointeger", (luaV_function) &dll_lua_tointeger},
297301
{"lua_call", (luaV_function) &dll_lua_call},
298302
{"lua_pcall", (luaV_function) &dll_lua_pcall},
299-
#elif LUA_VERSION_NUM <= 502
300-
{"lua_replace", (luaV_function) &dll_lua_replace},
301-
{"lua_remove", (luaV_function) &dll_lua_remove},
302303
#else
303-
{"lua_rotate", (luaV_function) &dll_lua_rotate},
304-
{"lua_copy", (luaV_function) &dll_lua_copy},
305304
{"lua_tonumberx", (luaV_function) &dll_lua_tonumberx},
306305
{"lua_tointegerx", (luaV_function) &dll_lua_tointegerx},
307306
{"lua_callk", (luaV_function) &dll_lua_callk},
308307
{"lua_pcallk", (luaV_function) &dll_lua_pcallk},
309308
{"lua_getglobal", (luaV_function) &dll_lua_getglobal},
310309
{"lua_setglobal", (luaV_function) &dll_lua_setglobal},
310+
#endif
311+
#if LUA_VERSION_NUM <= 502
312+
{"lua_replace", (luaV_function) &dll_lua_replace},
313+
{"lua_remove", (luaV_function) &dll_lua_remove},
314+
#endif
315+
#if LUA_VERSION_NUM >= 503
316+
{"lua_rotate", (luaV_function) &dll_lua_rotate},
317+
{"lua_copy", (luaV_function) &dll_lua_copy},
311318
#endif
312319
{"lua_typename", (luaV_function) &dll_lua_typename},
313320
{"lua_close", (luaV_function) &dll_lua_close},

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,8 @@ static char *(features[]) =
756756

757757
static int included_patches[] =
758758
{ /* Add new patch number below this line */
759+
/**/
760+
763,
759761
/**/
760762
762,
761763
/**/

0 commit comments

Comments
 (0)