modulemanager: Added module API function to get all items for a given host based on a key
authorWaqas Hussain <waqas20@gmail.com>
Tue, 18 Aug 2009 12:35:42 +0500
changeset 1698 af89f646200f
parent 1697 f1783e621a36
child 1699 53d16a28ee00
modulemanager: Added module API function to get all items for a given host based on a key
core/modulemanager.lua
--- a/core/modulemanager.lua	Tue Aug 18 12:34:59 2009 +0500
+++ b/core/modulemanager.lua	Tue Aug 18 12:35:42 2009 +0500
@@ -443,6 +443,19 @@
 	end
 end
 
+function api:get_host_items(key)
+	local result = {};
+	for mod_name, module in pairs(modulemap[self.host]) do
+		module = module.module;
+		if module.items then
+			for _, item in ipairs(module.items[key] or NULL) do
+				t_insert(result, item);
+			end
+		end
+	end
+	return result;
+end
+
 --------------------------------------------------------------------
 
 local actions = {};