aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-01-09 06:59:47 +0000
committerMatthew Wild <mwild1@gmail.com>2010-01-09 06:59:47 +0000
commit4da7be205c69218509f71c27308577a62fe04013 (patch)
treeb31784f1436722e1a77fbb26bc1101c85feba571 /core
parent0d8ce51b7813684f2130626d2a3aabdb9f9bb11e (diff)
downloadprosody-4da7be205c69218509f71c27308577a62fe04013.tar.gz
prosody-4da7be205c69218509f71c27308577a62fe04013.zip
configmanager: Add parsers() method to return an array of supported config formats
Diffstat (limited to 'core')
-rw-r--r--core/configmanager.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua
index 1fbe83b8..1f98bccc 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -9,8 +9,8 @@
local _G = _G;
-local setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type =
- setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type;
+local setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type, pairs, table =
+ setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type, pairs, table;
local eventmanager = require "core.eventmanager";
@@ -94,6 +94,15 @@ function addparser(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);
+ end
+ return p;
+end
+
-- Built-in Lua parser
do
local loadstring, pcall, setmetatable = _G.loadstring, _G.pcall, _G.setmetatable;