Changeset

5528:2539e60cc070

Merge 0.9->trunk
author Matthew Wild <mwild1@gmail.com>
date Sat, 27 Apr 2013 18:03:19 +0100
parents 5525:8e41b127e44e (current diff) 5527:7e7f45f587a1 (diff)
children 5534:522e99b898a0
files
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/core/moduleapi.lua	Sat Apr 27 13:11:27 2013 +0100
+++ b/core/moduleapi.lua	Sat Apr 27 18:03:19 2013 +0100
@@ -270,6 +270,22 @@
 	return set.new(value);
 end
 
+function api:get_option_inherited_set(name, ...)
+	local value = self:get_option_set(name, ...);
+	local global_value = self:context("*"):get_option_set(name, ...);
+	if not value then
+		return global_value;
+	elseif not global_value then
+		return value;
+	end
+	value:include(global_value);
+	return 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 {};