Changeset

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
parents 1697:f1783e621a36
children 1699:53d16a28ee00
files core/modulemanager.lua
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
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 = {};