summaryrefslogtreecommitdiffstats
path: root/awall
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2012-06-28 06:28:49 +0000
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2012-06-28 06:29:19 +0000
commit8e289c58be0225f9fe714116304fc1a32a1a5300 (patch)
treee3ff0428cbd9d733c15c4290e9a8831f2a095ce5 /awall
parentacb661e8fc9efbf68ed420278a7df4180a16e8af (diff)
downloadawall-8e289c58be0225f9fe714116304fc1a32a1a5300.tar.bz2
awall-8e289c58be0225f9fe714116304fc1a32a1a5300.tar.xz
streamlined variable expansion
side effects removed
Diffstat (limited to 'awall')
-rw-r--r--awall/policy.lua11
1 files changed, 2 insertions, 9 deletions
diff --git a/awall/policy.lua b/awall/policy.lua
index f966895..22544a6 100644
--- a/awall/policy.lua
+++ b/awall/policy.lua
@@ -60,17 +60,10 @@ end
function PolicyConfig:expand()
local function expand(obj)
- for k, v in pairs(obj) do
- if type(v) == 'table' then expand(v)
- else obj[k] = self:eval(v) end
- end
- end
-
- for k, v in pairs(self.data) do
- if k ~= 'variable' then expand(v) end
+ return type(obj) == 'table' and util.map(obj, expand) or self:eval(obj)
end
- return self.data
+ return expand(self.data)
end