# HG changeset patch # User Matthew Wild # Date 1263020387 0 # Node ID 343a9eb7540e738d41ca156a0c4c7dade9daf490 # Parent 4cef9808662a35875639806f06946ff41eb2616c configmanager: Add parsers() method to return an array of supported config formats diff -r 4cef9808662a -r 343a9eb7540e core/configmanager.lua --- a/core/configmanager.lua Sat Jan 09 06:53:23 2010 +0000 +++ b/core/configmanager.lua Sat Jan 09 06:59:47 2010 +0000 @@ -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 @@ 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;