From f22985613d09529d106b4c01b7a36a06a3ebb549 Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Fri, 24 Aug 2012 12:17:03 +0000 Subject: substitute table.concat for util.join --- awall/ipset.lua | 3 +-- awall/model.lua | 16 ++++++++-------- awall/util.lua | 9 --------- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/awall/ipset.lua b/awall/ipset.lua index 2b78495..ceba5e6 100644 --- a/awall/ipset.lua +++ b/awall/ipset.lua @@ -8,7 +8,6 @@ Licensed under the terms of GPL2 module(..., package.seeall) require 'awall.object' -require 'awall.util' IPSet = awall.object.class(awall.object.Object) @@ -23,7 +22,7 @@ end function IPSet:dumpfile(name, ipsfile) ipsfile:write('# ipset '..name..'\n') - ipsfile:write(awall.util.join(self:options(name), ' ')) + ipsfile:write(table.concat(self:options(name), ' ')) ipsfile:write('\n') end diff --git a/awall/model.lua b/awall/model.lua index 5ed9d68..264a6b3 100644 --- a/awall/model.lua +++ b/awall/model.lua @@ -237,7 +237,7 @@ function Rule:servoptfrags() if len == 1 then opts = opts..' --dport '..plist[1] elseif len > 1 then - opts = opts..' -m multiport --dports '..util.join(plist, ',') + opts = opts..' -m multiport --dports '..table.concat(plist, ',') end table.insert(res, {opts=opts}) @@ -311,13 +311,13 @@ function Rule:trules() end local setopts = '-m set --match-set '..ipset.name..' ' - setopts = setopts..util.join(util.map(util.list(ipset.args), - function(a) - if a == 'in' then return 'src' end - if a == 'out' then return 'dst' end - self:error('Invalid set direction argument') - end), - ',') + setopts = setopts..table.concat(util.map(util.list(ipset.args), + function(a) + if a == 'in' then return 'src' end + if a == 'out' then return 'dst' end + self:error('Invalid set direction argument') + end), + ',') table.insert(ipsetofrags, {family=setdef.family, opts=setopts}) end res = combinations(res, ipsetofrags) diff --git a/awall/util.lua b/awall/util.lua index 3479124..dad057e 100644 --- a/awall/util.lua +++ b/awall/util.lua @@ -7,15 +7,6 @@ Licensed under the terms of GPL2 module(..., package.seeall) -function join(var, sep) - local res = '' - for i, s in listpairs(var) do - if i > 1 then res = res..sep end - res = res..s - end - return res -end - function list(var) if not var then return {} end if type(var) ~= 'table' then return {var} end -- cgit v1.2.3