Skip to content

Commit 1741367

Browse files
committed
patch 8.1.0183: Lua API changed, breaking the build
Problem: Lua API changed, breaking the build. Solution: Adjust prototype of lua_rawgeti(). (Ken Takata, closes #3157, closes #3144)
1 parent 4fc8500 commit 1741367

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

src/if_lua.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,23 @@ void (*dll_lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
253253
void (*dll_lua_pushboolean) (lua_State *L, int b);
254254
void (*dll_lua_pushlightuserdata) (lua_State *L, void *p);
255255
void (*dll_lua_getfield) (lua_State *L, int idx, const char *k);
256+
#if LUA_VERSION_NUM <= 502
256257
void (*dll_lua_rawget) (lua_State *L, int idx);
257258
void (*dll_lua_rawgeti) (lua_State *L, int idx, int n);
259+
#else
260+
int (*dll_lua_rawget) (lua_State *L, int idx);
261+
int (*dll_lua_rawgeti) (lua_State *L, int idx, lua_Integer n);
262+
#endif
258263
void (*dll_lua_createtable) (lua_State *L, int narr, int nrec);
259264
void *(*dll_lua_newuserdata) (lua_State *L, size_t sz);
260265
int (*dll_lua_getmetatable) (lua_State *L, int objindex);
261266
void (*dll_lua_setfield) (lua_State *L, int idx, const char *k);
262267
void (*dll_lua_rawset) (lua_State *L, int idx);
268+
#if LUA_VERSION_NUM <= 502
263269
void (*dll_lua_rawseti) (lua_State *L, int idx, int n);
270+
#else
271+
void (*dll_lua_rawseti) (lua_State *L, int idx, lua_Integer n);
272+
#endif
264273
int (*dll_lua_setmetatable) (lua_State *L, int objindex);
265274
int (*dll_lua_next) (lua_State *L, int idx);
266275
/* libs */
@@ -962,7 +971,8 @@ luaV_dict_newindex(lua_State *L)
962971
return 0;
963972
if (*key == NUL)
964973
luaL_error(L, "empty key");
965-
if (!lua_isnil(L, 3)) { /* read value? */
974+
if (!lua_isnil(L, 3)) /* read value? */
975+
{
966976
luaV_checktypval(L, 3, &v, "setting dict item");
967977
if (d->dv_scope == VAR_DEF_SCOPE && v.v_type == VAR_FUNC)
968978
luaL_error(L, "cannot assign funcref to builtin scope");
@@ -1074,7 +1084,8 @@ luaV_funcref_call(lua_State *L)
10741084
status = FAIL;
10751085
else
10761086
{
1077-
for (i = 0; i < n; i++) {
1087+
for (i = 0; i < n; i++)
1088+
{
10781089
luaV_checktypval(L, i + 2, &v, "calling funcref");
10791090
list_append_tv(f->args.vval.v_list, &v);
10801091
}
@@ -1531,13 +1542,16 @@ luaV_list(lua_State *L)
15311542
else
15321543
{
15331544
luaV_newlist(L, l);
1534-
if (initarg) { /* traverse table to init dict */
1545+
if (initarg) /* traverse table to init list */
1546+
{
15351547
int notnil, i = 0;
15361548
typval_T v;
1537-
do {
1549+
do
1550+
{
15381551
lua_rawgeti(L, 1, ++i);
15391552
notnil = !lua_isnil(L, -1);
1540-
if (notnil) {
1553+
if (notnil)
1554+
{
15411555
luaV_checktypval(L, -1, &v, "vim.list");
15421556
list_append_tv(l, &v);
15431557
}

src/version.c

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

790790
static int included_patches[] =
791791
{ /* Add new patch number below this line */
792+
/**/
793+
183,
792794
/**/
793795
182,
794796
/**/

0 commit comments

Comments
 (0)