diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-04-27 14:57:24 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-04-27 14:57:24 +0100 |
commit | 75fb113a5bba95812e03c990d5e7df34226b4d31 (patch) | |
tree | fd70b0d3f027ee75d470774a4c42e223d9955666 /core/moduleapi.lua | |
parent | c2232bc15a95694f28440642cc7c9cf5f76fae7f (diff) | |
download | prosody-75fb113a5bba95812e03c990d5e7df34226b4d31.tar.gz prosody-75fb113a5bba95812e03c990d5e7df34226b4d31.zip |
moduleapi: Add module:context(host) to produce a fake API context for a given host (or global). module:context("*"):get_option("foo") to get global options.
Diffstat (limited to 'core/moduleapi.lua')
-rw-r--r-- | core/moduleapi.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua index 30360f73..da44db5f 100644 --- a/core/moduleapi.lua +++ b/core/moduleapi.lua @@ -270,6 +270,10 @@ function api:get_option_set(name, ...) return set.new(value); end +function api:context(host) + return setmetatable({host=host or "*"}, {__index=self,__newindex=self}); +end + function api:add_item(key, value) self.items = self.items or {}; self.items[key] = self.items[key] or {}; |