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.
--- a/core/moduleapi.lua Sat Apr 27 13:11:03 2013 +0100
+++ b/core/moduleapi.lua Sat Apr 27 14:57:24 2013 +0100
@@ -270,6 +270,10 @@
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 {};