Commit 65c82f54 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

PolicyConfig: make copy of substituted table variables

parent f11784f3
......@@ -48,7 +48,7 @@ function PolicyConfig:expand()
local var = self.data.variable[name]
if var == nil then raise('Invalid variable reference: '..name) end
if si == 1 and ei == value:len() then value = var
if si == 1 and ei == value:len() then value = util.copy(var)
elseif contains({'number', 'string'}, type(var)) then
value = value:sub(1, si - 1)..var..value:sub(ei + 1, -1)
else
......
......@@ -85,7 +85,9 @@ function M.setdefault(t, k, v)
return t[k]
end
function M.copy(tbl) return M.update({}, tbl) end
function M.copy(var)
return type(var) == 'table' and M.update({}, var) or var
end
function M.compare(a, b)
local t = type(a)
......
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