summaryrefslogtreecommitdiff
path: root/src/conf.lua
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-05-08 17:35:26 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-05-08 17:35:26 (GMT)
commit87a905c4419d6b83dde4209a84c4726f532b1845 (patch)
tree57431df5fe1ebe6397c4a716637024b4cc803bfc /src/conf.lua
parente0997d02f2b4276ac7facd50532d4d2301908d7b (diff)
conf refactoring for nopyncd
Diffstat (limited to 'src/conf.lua')
-rw-r--r--src/conf.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/conf.lua b/src/conf.lua
index a0af5d3..44546cc 100644
--- a/src/conf.lua
+++ b/src/conf.lua
@@ -21,13 +21,19 @@
local conf = {}
-local file = assert(io.open(conffile, "r"))
-for line in file:lines() do
- local k,v = string.match(line, "^([^=#]+)=(.*)$")
- if k and v and v ~= "" then
- conf[k] = v
+function conf.load(conffile)
+ local cnf = {}
+
+ local file = assert(io.open(conffile, "r"))
+ for line in file:lines() do
+ local k,v = string.match(line, "^([^=#]+)=(.*)$")
+ if k and v and v ~= "" then
+ cnf[k] = v
+ end
end
+ file:close()
+
+ return cnf
end
-file:close()
return conf