moduleapi: module:depends(): Load shared modules onto the current host even if they are loaded globally already
authorMatthew Wild <mwild1@gmail.com>
Mon, 23 Apr 2012 14:15:07 +0100
changeset 4663 24524d70a50a
parent 4662 105423f77d46
child 4664 7438b3c68576
moduleapi: module:depends(): Load shared modules onto the current host even if they are loaded globally already
core/moduleapi.lua
--- a/core/moduleapi.lua	Mon Apr 23 14:11:10 2012 +0100
+++ b/core/moduleapi.lua	Mon Apr 23 14:15:07 2012 +0100
@@ -120,6 +120,9 @@
 		end);
 	end
 	local mod = modulemanager.get_module(self.host, name) or modulemanager.get_module("*", name);
+	if mod and mod.module.host == "*" and modulemanager.module_has_method(mod, "add_host") then
+		mod = nil; -- This is a shared module, so we still want to load it on our host
+	end
 	if not mod then
 		local err;
 		mod, err = modulemanager.load(self.host, name);