Software /
code /
prosody
Diff
core/modulemanager.lua @ 5420:706053e3f9f5
Merge 0.9->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 03 Apr 2013 13:53:21 +0100 |
parent | 5411:82b3ddba0ec7 |
child | 5776:bd0ff8ae98a8 |
child | 6034:ee14da71d3fc |
line wrap: on
line diff
--- a/core/modulemanager.lua Sun Mar 31 13:21:19 2013 +0100 +++ b/core/modulemanager.lua Wed Apr 03 13:53:21 2013 +0100 @@ -19,7 +19,7 @@ local pcall, xpcall = pcall, xpcall; local setmetatable, rawget = setmetatable, rawget; -local pairs, type, tostring = pairs, type, tostring; +local ipairs, pairs, type, tostring, t_insert = ipairs, pairs, type, tostring, table.insert; local debug_traceback = debug.traceback; local unpack, select = unpack, select; @@ -278,6 +278,23 @@ return modulemap[host] and modulemap[host][name]; end +function get_items(key, host) + local result = {}; + local modules = modulemap[host]; + if not key or not host or not modules then return nil; end + + for _, module in pairs(modules) do + local mod = module.module; + if mod.items and mod.items[key] then + for _, value in ipairs(mod.items[key]) do + t_insert(result, value); + end + end + end + + return result; +end + function get_modules(host) return modulemap[host]; end