aboutsummaryrefslogtreecommitdiffstats
path: root/core/configmanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2015-05-18 19:04:37 +0100
committerMatthew Wild <mwild1@gmail.com>2015-05-18 19:04:37 +0100
commitc9c311b940c4d17cf3d2794323d0788cfd1e07da (patch)
treec0db8f5fabe00d2a1097a8440ecdf5a97714905e /core/configmanager.lua
parent7523668ad017bc468e2946b7744b92de90006fac (diff)
downloadprosody-c9c311b940c4d17cf3d2794323d0788cfd1e07da.tar.gz
prosody-c9c311b940c4d17cf3d2794323d0788cfd1e07da.zip
configmanager: Rename variable to avoid name conflict [luacheck]
Diffstat (limited to 'core/configmanager.lua')
-rw-r--r--core/configmanager.lua27
1 files changed, 12 insertions, 15 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua
index 5891c59a..91e7b22c 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -73,20 +73,20 @@ function _M.set(host, key, value, _oldvalue)
return set(config, host, key, value);
end
-function load(filename, format)
- format = format or filename:match("%w+$");
+function load(filename, config_format)
+ config_format = config_format or filename:match("%w+$");
- if parsers[format] and parsers[format].load then
+ if parsers[config_format] and parsers[config_format].load then
local f, err = io.open(filename);
if f then
local new_config = setmetatable({ ["*"] = { } }, config_mt);
- local ok, err = parsers[format].load(f:read("*a"), filename, new_config);
+ local ok, err = parsers[config_format].load(f:read("*a"), filename, new_config);
f:close();
if ok then
config = new_config;
fire_event("config-reloaded", {
filename = filename,
- format = format,
+ format = config_format,
config = config
});
end
@@ -95,27 +95,24 @@ function load(filename, format)
return f, "file", err;
end
- if not format then
+ if not config_format then
return nil, "file", "no parser specified";
else
- return nil, "file", "no parser for "..(format);
+ return nil, "file", "no parser for "..(config_format);
end
end
-function save(filename, format)
-end
-
-function addparser(format, parser)
- if format and parser then
- parsers[format] = parser;
+function addparser(config_format, parser)
+ if config_format and parser then
+ parsers[config_format] = parser;
end
end
-- _M needed to avoid name clash with local 'parsers'
function _M.parsers()
local p = {};
- for format in pairs(parsers) do
- table.insert(p, format);
+ for config_format in pairs(parsers) do
+ table.insert(p, config_format);
end
return p;
end