Changeset

2427:343a9eb7540e

configmanager: Add parsers() method to return an array of supported config formats
author Matthew Wild <mwild1@gmail.com>
date Sat, 09 Jan 2010 06:59:47 +0000
parents 2426:4cef9808662a
children 2428:3ba9db4b9311
files core/configmanager.lua
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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;