diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-05-08 17:35:26 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-05-08 17:35:26 (GMT) |
commit | 87a905c4419d6b83dde4209a84c4726f532b1845 (patch) | |
tree | 57431df5fe1ebe6397c4a716637024b4cc803bfc /src/conf.lua | |
parent | e0997d02f2b4276ac7facd50532d4d2301908d7b (diff) |
conf refactoring for nopyncd
Diffstat (limited to 'src/conf.lua')
-rw-r--r-- | src/conf.lua | 18 |
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 |