Diff

core/modulemanager.lua @ 1698:af89f646200f

modulemanager: Added module API function to get all items for a given host based on a key
author Waqas Hussain <waqas20@gmail.com>
date Tue, 18 Aug 2009 12:35:42 +0500
parent 1697:f1783e621a36
child 1706:0e6ba1678d8e
line wrap: on
line diff
--- 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 = {};