Comparison

core/moduleapi.lua @ 4663:24524d70a50a

moduleapi: module:depends(): Load shared modules onto the current host even if they are loaded globally already
author Matthew Wild <mwild1@gmail.com>
date Mon, 23 Apr 2012 14:15:07 +0100
parent 4661:76db5d0a2104
child 4666:fb522fbd495e
comparison
equal deleted inserted replaced
4662:105423f77d46 4663:24524d70a50a
118 modulemanager.unload(self.host, self.name); 118 modulemanager.unload(self.host, self.name);
119 end 119 end
120 end); 120 end);
121 end 121 end
122 local mod = modulemanager.get_module(self.host, name) or modulemanager.get_module("*", name); 122 local mod = modulemanager.get_module(self.host, name) or modulemanager.get_module("*", name);
123 if mod and mod.module.host == "*" and modulemanager.module_has_method(mod, "add_host") then
124 mod = nil; -- This is a shared module, so we still want to load it on our host
125 end
123 if not mod then 126 if not mod then
124 local err; 127 local err;
125 mod, err = modulemanager.load(self.host, name); 128 mod, err = modulemanager.load(self.host, name);
126 if not mod then 129 if not mod then
127 return error(("Unable to load required module, mod_%s: %s"):format(name, ((err or "unknown error"):gsub("%-", " ")) )); 130 return error(("Unable to load required module, mod_%s: %s"):format(name, ((err or "unknown error"):gsub("%-", " ")) ));