diff options
author | Matthew Wild <mwild1@gmail.com> | 2008-11-29 03:28:07 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2008-11-29 03:28:07 +0000 |
commit | f03d1616f0b685bda23dfbe79d4d8cc7fd95fde5 (patch) | |
tree | 132e2f26bf8f64086adc5f75fc45a9921a1e5e4c /core/configmanager.lua | |
parent | e7cfd639687786d0426897f4706200818c66295a (diff) | |
parent | 7271c148cef981f9263a8794ebe27634423b07bd (diff) | |
download | prosody-f03d1616f0b685bda23dfbe79d4d8cc7fd95fde5.tar.gz prosody-f03d1616f0b685bda23dfbe79d4d8cc7fd95fde5.zip |
Automated merge with http://waqas.ath.cx/
Diffstat (limited to 'core/configmanager.lua')
-rw-r--r-- | core/configmanager.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua index 5f5648b9..a4a24fad 100644 --- a/core/configmanager.lua +++ b/core/configmanager.lua @@ -2,6 +2,7 @@ local _G = _G; local setmetatable, loadfile, pcall, rawget, rawset, io = setmetatable, loadfile, pcall, rawget, rawset, io; + module "configmanager" local parsers = {}; @@ -52,18 +53,21 @@ end function load(filename, format) format = format or filename:match("%w+$"); + if parsers[format] and parsers[format].load then - local f = io.open(filename); + local f, err = io.open(filename); if f then local ok, err = parsers[format].load(f:read("*a")); f:close(); return ok, err; end + return f, err; end + if not format then return nil, "no parser specified"; else - return false, "no parser"; + return nil, "no parser for "..(format); end end @@ -118,4 +122,4 @@ do end -return _M;
\ No newline at end of file +return _M; |