forked from aniani/vim
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)
This commit is contained in:
24
src/if_lua.c
24
src/if_lua.c
@@ -253,14 +253,23 @@ void (*dll_lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
|
|||||||
void (*dll_lua_pushboolean) (lua_State *L, int b);
|
void (*dll_lua_pushboolean) (lua_State *L, int b);
|
||||||
void (*dll_lua_pushlightuserdata) (lua_State *L, void *p);
|
void (*dll_lua_pushlightuserdata) (lua_State *L, void *p);
|
||||||
void (*dll_lua_getfield) (lua_State *L, int idx, const char *k);
|
void (*dll_lua_getfield) (lua_State *L, int idx, const char *k);
|
||||||
|
#if LUA_VERSION_NUM <= 502
|
||||||
void (*dll_lua_rawget) (lua_State *L, int idx);
|
void (*dll_lua_rawget) (lua_State *L, int idx);
|
||||||
void (*dll_lua_rawgeti) (lua_State *L, int idx, int n);
|
void (*dll_lua_rawgeti) (lua_State *L, int idx, int n);
|
||||||
|
#else
|
||||||
|
int (*dll_lua_rawget) (lua_State *L, int idx);
|
||||||
|
int (*dll_lua_rawgeti) (lua_State *L, int idx, lua_Integer n);
|
||||||
|
#endif
|
||||||
void (*dll_lua_createtable) (lua_State *L, int narr, int nrec);
|
void (*dll_lua_createtable) (lua_State *L, int narr, int nrec);
|
||||||
void *(*dll_lua_newuserdata) (lua_State *L, size_t sz);
|
void *(*dll_lua_newuserdata) (lua_State *L, size_t sz);
|
||||||
int (*dll_lua_getmetatable) (lua_State *L, int objindex);
|
int (*dll_lua_getmetatable) (lua_State *L, int objindex);
|
||||||
void (*dll_lua_setfield) (lua_State *L, int idx, const char *k);
|
void (*dll_lua_setfield) (lua_State *L, int idx, const char *k);
|
||||||
void (*dll_lua_rawset) (lua_State *L, int idx);
|
void (*dll_lua_rawset) (lua_State *L, int idx);
|
||||||
|
#if LUA_VERSION_NUM <= 502
|
||||||
void (*dll_lua_rawseti) (lua_State *L, int idx, int n);
|
void (*dll_lua_rawseti) (lua_State *L, int idx, int n);
|
||||||
|
#else
|
||||||
|
void (*dll_lua_rawseti) (lua_State *L, int idx, lua_Integer n);
|
||||||
|
#endif
|
||||||
int (*dll_lua_setmetatable) (lua_State *L, int objindex);
|
int (*dll_lua_setmetatable) (lua_State *L, int objindex);
|
||||||
int (*dll_lua_next) (lua_State *L, int idx);
|
int (*dll_lua_next) (lua_State *L, int idx);
|
||||||
/* libs */
|
/* libs */
|
||||||
@@ -962,7 +971,8 @@ luaV_dict_newindex(lua_State *L)
|
|||||||
return 0;
|
return 0;
|
||||||
if (*key == NUL)
|
if (*key == NUL)
|
||||||
luaL_error(L, "empty key");
|
luaL_error(L, "empty key");
|
||||||
if (!lua_isnil(L, 3)) { /* read value? */
|
if (!lua_isnil(L, 3)) /* read value? */
|
||||||
|
{
|
||||||
luaV_checktypval(L, 3, &v, "setting dict item");
|
luaV_checktypval(L, 3, &v, "setting dict item");
|
||||||
if (d->dv_scope == VAR_DEF_SCOPE && v.v_type == VAR_FUNC)
|
if (d->dv_scope == VAR_DEF_SCOPE && v.v_type == VAR_FUNC)
|
||||||
luaL_error(L, "cannot assign funcref to builtin scope");
|
luaL_error(L, "cannot assign funcref to builtin scope");
|
||||||
@@ -1074,7 +1084,8 @@ luaV_funcref_call(lua_State *L)
|
|||||||
status = FAIL;
|
status = FAIL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++)
|
||||||
|
{
|
||||||
luaV_checktypval(L, i + 2, &v, "calling funcref");
|
luaV_checktypval(L, i + 2, &v, "calling funcref");
|
||||||
list_append_tv(f->args.vval.v_list, &v);
|
list_append_tv(f->args.vval.v_list, &v);
|
||||||
}
|
}
|
||||||
@@ -1531,13 +1542,16 @@ luaV_list(lua_State *L)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
luaV_newlist(L, l);
|
luaV_newlist(L, l);
|
||||||
if (initarg) { /* traverse table to init dict */
|
if (initarg) /* traverse table to init list */
|
||||||
|
{
|
||||||
int notnil, i = 0;
|
int notnil, i = 0;
|
||||||
typval_T v;
|
typval_T v;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
lua_rawgeti(L, 1, ++i);
|
lua_rawgeti(L, 1, ++i);
|
||||||
notnil = !lua_isnil(L, -1);
|
notnil = !lua_isnil(L, -1);
|
||||||
if (notnil) {
|
if (notnil)
|
||||||
|
{
|
||||||
luaV_checktypval(L, -1, &v, "vim.list");
|
luaV_checktypval(L, -1, &v, "vim.list");
|
||||||
list_append_tv(l, &v);
|
list_append_tv(l, &v);
|
||||||
}
|
}
|
||||||
|
@@ -789,6 +789,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
183,
|
||||||
/**/
|
/**/
|
||||||
182,
|
182,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user