Commit 65d36f6f authored by Kaarle Ritvanen's avatar Kaarle Ritvanen
Browse files

use table.unpack

parent ca2cdba6
......@@ -14,6 +14,9 @@ signal = posix.signal
stringy = require('stringy')
-- Lua 5.1 compatibility
if not table.unpack then table.unpack = unpack end
function help()
io.stderr:write([[
Alpine Wall
......
......@@ -19,7 +19,7 @@ local function class(base)
return function(...)
local arg = {...}
arg[1] = obj
return v(unpack(arg))
return v(table.unpack(arg))
end
end
}
......
......@@ -20,8 +20,9 @@ end
function IPSet:create()
for name, ipset in pairs(self.config) do
local pid = lpc.run('ipset', '-!', 'create', name,
unpack(ipset.options))
local pid = lpc.run(
'ipset', '-!', 'create', name, table.unpack(ipset.options)
)
if lpc.wait(pid) ~= 0 then
io.stderr:write('ipset creation failed: '..name)
end
......
......@@ -61,8 +61,9 @@ function BaseIPTables:restore(test)
if file then
io.close(file)
local pid, stdin, stdout = lpc.run(params.cmd..'-restore',
unpack({test and '-t' or nil}))
local pid, stdin, stdout = lpc.run(
params.cmd..'-restore', table.unpack{test and '-t' or nil}
)
stdout:close()
self:dumpfile(family, stdin)
stdin:close()
......
......@@ -41,7 +41,7 @@ function FilterLimit:recentofrags(name)
for _, family in ipairs{'inet', 'inet6'} do
if type(self.mask[family].mode) ~= 'table' then return end
local mask = ''
local attr, len = unpack(self.mask[family].mode)
local attr, len = table.unpack(self.mask[family].mode)
if family == 'inet' then
local octet
......
......@@ -16,7 +16,7 @@ function M.combinations(of1, ...)
local of2 = arg[1]
table.remove(arg, 1)
if not of2 then return M.combinations(of1, unpack(arg)) end
if not of2 then return M.combinations(of1, table.unpack(arg)) end
local res = {}
for i, x in ipairs(of1) do
......@@ -48,7 +48,7 @@ function M.combinations(of1, ...)
end
end
return M.combinations(res, unpack(arg))
return M.combinations(res, table.unpack(arg))
end
function M.location(of) return of.family..'/'..of.table..'/'..of.chain end
......
......@@ -14,7 +14,7 @@ function M.raise(msg) error(prefix..msg) end
function M.call(f, ...)
local arg = {...}
return xpcall(
function() f(unpack(arg)) end,
function() f(table.unpack(arg)) end,
function(msg)
local si, ei = msg:find(prefix, 1, true)
if si then msg = 'awall: '..msg:sub(ei + 1, -1) end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment