summaryrefslogtreecommitdiffstats
path: root/aconf/persistence
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-03-24 23:03:02 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-03-25 09:03:09 +0200
commit0490dce7900c65fd22daca163356c499fc527c42 (patch)
treee55a6199bcd188c4d54bbf94f3a9475d7b37f981 /aconf/persistence
parent110544c9c7ed7af1e4da474b2ed90e75c050ffc0 (diff)
downloadaconf-0490dce7900c65fd22daca163356c499fc527c42.tar.bz2
aconf-0490dce7900c65fd22daca163356c499fc527c42.tar.xz
persistence: rename variable
Diffstat (limited to 'aconf/persistence')
-rw-r--r--aconf/persistence/init.lua28
1 files changed, 15 insertions, 13 deletions
diff --git a/aconf/persistence/init.lua b/aconf/persistence/init.lua
index 991776a..c1398fa 100644
--- a/aconf/persistence/init.lua
+++ b/aconf/persistence/init.lua
@@ -45,30 +45,32 @@ function DataStore:get(path)
local backend, comps = self:split_path(path)
local top = topology(path)
- local res = backend:get(comps, top)
+ local value = backend:get(comps, top)
if top then
local t = top.type
- if t and res ~= nil then
- local atype = type(res)
+ if t and value ~= nil then
+ local atype = type(value)
if t == 'table' then assert(atype == 'table')
else
assert(atype ~= 'table')
- if t == 'string' then res = tostring(res)
- elseif t == 'number' then res = tonumber(res)
+ if t == 'string' then value = tostring(value)
+ elseif t == 'number' then value = tonumber(value)
elseif t == 'boolean' then
- if atype == 'string' then res = res:lower() end
- if res == 1 or contains({'1', 't', 'true', 'y', 'yes'}, res) then
- res = true
- elseif res == 0 or contains(
- {'0', 'f', 'false', 'n', 'no'}, res
+ if atype == 'string' then value = value:lower() end
+ if value == 1 or contains(
+ {'1', 't', 'true', 'y', 'yes'}, value
+ ) then
+ value = true
+ elseif value == 0 or contains(
+ {'0', 'f', 'false', 'n', 'no'}, value
) then
- res = false
- else res = res and true or false end
+ value = false
+ else value = value and true or false end
elseif contains({'binary', 'reference'}, t) then
assert(atype == 'string')
@@ -78,7 +80,7 @@ function DataStore:get(path)
end
end
- return util.copy(res), self.mod_time[path] or 0
+ return util.copy(value), self.mod_time[path] or 0
end
function DataStore:_set_multiple(mods)