core/modulemanager.lua

changeset 1394
2ebed659b958
parent 1393
576143941a76
parent 1389
846df07536eb
child 1447
cc20d6dfa32d
--- a/core/modulemanager.lua	Tue Jun 23 02:15:04 2009 +0500
+++ b/core/modulemanager.lua	Tue Jun 23 15:58:56 2009 +0100
@@ -38,7 +38,8 @@
 
 module "modulemanager"
 
-local api = {}; -- Module API container
+api = {};
+local api = api; -- Module API container
 
 local modulemap = { ["*"] = {} };
 
@@ -134,6 +135,13 @@
 		return nil, ret;
 	end
 	
+	if module_has_method(pluginenv, "load") then
+		local ok, err = call_module_method(pluginenv, "load");
+		if (not ok) and err then
+			log("warn", "Error loading module '%s' on '%s': %s", module_name, host, err);
+		end
+	end
+
 	-- Use modified host, if the module set one
 	modulemap[api_instance.host][module_name] = pluginenv;
 	
@@ -190,7 +198,7 @@
 
 	local _mod, err = pluginloader.load_code(name); -- checking for syntax errors
 	if not _mod then
-		log("error", "Unable to load module '%s': %s", module_name or "nil", err or "nil");
+		log("error", "Unable to load module '%s': %s", name or "nil", err or "nil");
 		return nil, err;
 	end
 

mercurial