summaryrefslogtreecommitdiffstats
path: root/aconf/persistence/backends
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-04-15 22:59:21 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-04-15 22:59:21 +0300
commitd9decd5a0dd0abbe7842da4400e665d96d6b8f9b (patch)
tree27a1807e9f8d1fa69b4ba0f0a2f2b5080906a825 /aconf/persistence/backends
parent909197f81d7cc47f6bfbaed39727c59245584bbb (diff)
downloadaconf-d9decd5a0dd0abbe7842da4400e665d96d6b8f9b.tar.bz2
aconf-d9decd5a0dd0abbe7842da4400e665d96d6b8f9b.tar.xz
use 'unpack' function from 'table' module
Diffstat (limited to 'aconf/persistence/backends')
-rw-r--r--aconf/persistence/backends/augeas.lua10
-rw-r--r--aconf/persistence/backends/files.lua6
-rw-r--r--aconf/persistence/backends/json.lua4
-rw-r--r--aconf/persistence/backends/service.lua2
-rw-r--r--aconf/persistence/backends/volatile.lua2
5 files changed, 13 insertions, 11 deletions
diff --git a/aconf/persistence/backends/augeas.lua b/aconf/persistence/backends/augeas.lua
index a448e65..7ffccb9 100644
--- a/aconf/persistence/backends/augeas.lua
+++ b/aconf/persistence/backends/augeas.lua
@@ -161,7 +161,7 @@ function backend:set(mods)
local gc = {}
for _, mod in ipairs(mods) do
- local path, value = unpack(mod)
+ local path, value = table.unpack(mod)
local function insert(path, new)
local apath, mode, keys = conv_path(path)
@@ -173,7 +173,7 @@ function backend:set(mods)
local ppath, pmode = conv_path(parent)
if pmode then
- gc[pth.join(unpack(array_without_last(parent)))] = false
+ gc[pth.join(table.unpack(array_without_last(parent)))] = false
end
if pmode == '#' then
@@ -239,7 +239,7 @@ function backend:set(mods)
self.aug:set(apath, value ~= nil and tostr(value) or nil)
end
- util.setdefault(gc, pth.join(unpack(path)), true)
+ util.setdefault(gc, pth.join(table.unpack(path)), true)
end
for path, _ in pairs(gc) do
@@ -255,7 +255,9 @@ function backend:set(mods)
break
end
- if gc[pth.join(unpack(p))] ~= false then self.aug:rm(conv_path(p)) end
+ if gc[pth.join(table.unpack(p))] ~= false then
+ self.aug:rm(conv_path(p))
+ end
p[#p] = nil
end
end
diff --git a/aconf/persistence/backends/files.lua b/aconf/persistence/backends/files.lua
index e19763d..1c78c80 100644
--- a/aconf/persistence/backends/files.lua
+++ b/aconf/persistence/backends/files.lua
@@ -29,7 +29,7 @@ local backend = require('aconf.object').class()
function backend:init() self.cache = {} end
function backend:get(path, top)
- local name = pth.join('/', unpack(path))
+ local name = pth.join('/', table.unpack(path))
if not self.cache[name] then
local t = posix.stat(name, 'type')
@@ -68,8 +68,8 @@ end
function backend:set(mods)
for _, mod in pairs(mods) do
- local path, value = unpack(mod)
- local name = pth.join('/', unpack(path))
+ local path, value = table.unpack(mod)
+ local name = pth.join('/', table.unpack(path))
if value == nil then
print('DEL', name)
diff --git a/aconf/persistence/backends/json.lua b/aconf/persistence/backends/json.lua
index 607315a..bdf2715 100644
--- a/aconf/persistence/backends/json.lua
+++ b/aconf/persistence/backends/json.lua
@@ -26,7 +26,7 @@ function backend:split_path(path)
local res
while #fpath > 0 do
- local fp = pth.join('/', unpack(fpath))
+ local fp = pth.join('/', table.unpack(fpath))
if self.cache[fp] then return fp, jpath end
table.insert(jpath, 1, fpath[#fpath])
table.remove(fpath)
@@ -62,7 +62,7 @@ function backend:set(mods)
local dirty = {}
for _, mod in ipairs(mods) do
- local path, value = unpack(mod)
+ local path, value = table.unpack(mod)
local fpath, jpath = self:split_path(path)
self.cache[fpath]:_set(jpath, value)
dirty[fpath] = true
diff --git a/aconf/persistence/backends/service.lua b/aconf/persistence/backends/service.lua
index 4569ce8..bd52d31 100644
--- a/aconf/persistence/backends/service.lua
+++ b/aconf/persistence/backends/service.lua
@@ -19,7 +19,7 @@ end
function backend:set(mods)
for _, mod in ipairs(mods) do
- local path, value = unpack(mod)
+ local path, value = table.unpack(mod)
assert(#path == 2 and path[2] == 'enabled')
local name = path[1]
diff --git a/aconf/persistence/backends/volatile.lua b/aconf/persistence/backends/volatile.lua
index 7016a9b..1a05b1b 100644
--- a/aconf/persistence/backends/volatile.lua
+++ b/aconf/persistence/backends/volatile.lua
@@ -39,7 +39,7 @@ function backend:_set(path, value)
end
function backend:set(mods)
- for _, mod in ipairs(mods) do self:_set(unpack(mod)) end
+ for _, mod in ipairs(mods) do self:_set(table.unpack(mod)) end
end