test: Lua 5.2/5.3 compat

close #9515
ref #9280
This commit is contained in:
Matěj Cepl 2019-01-17 15:58:05 +01:00 committed by Justin M. Keyes
parent 279043d625
commit a8a38f3465
3 changed files with 2 additions and 3 deletions

View File

@ -1,4 +1,3 @@
require('vim.compat')
require('coxpcall')
local luv = require('luv')
local lfs = require('lfs')

View File

@ -1,3 +1,4 @@
require('vim.compat')
local assert = require('luassert')
local luv = require('luv')
local lfs = require('lfs')

View File

@ -114,8 +114,7 @@ local lua2obj_type_tab = {
api.xmalloc(len * ffi.sizeof('KeyValuePair'))),
}})
for i = 1, len do
local table_unpack = table.unpack or unpack -- luacheck: compat
local key, val = table_unpack(kvs[i])
local key, val = unpack(kvs[i])
dct.data.dictionary.items[i - 1] = ffi.new(
'KeyValuePair', {key=ffi.gc(lua2obj(key), nil).data.string,
value=ffi.gc(lua2obj(val), nil)})