Changeset

6415:010b141e91ed

core.modulemanager, core.moduleapi: Hack around dependency loop
author Kim Alvefur <zash@zash.se>
date Wed, 17 Sep 2014 14:48:49 +0200
parents 6414:31c15004bfb0
children 6416:9af742bb45b2
files core/moduleapi.lua core/modulemanager.lua
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/core/moduleapi.lua	Wed Sep 17 14:47:52 2014 +0200
+++ b/core/moduleapi.lua	Wed Sep 17 14:48:49 2014 +0200
@@ -7,7 +7,7 @@
 --
 
 local config = require "core.configmanager";
-local modulemanager = require "modulemanager"; -- This is necessary to avoid require loops
+local modulemanager; -- This gets set from modulemanager
 local array = require "util.array";
 local set = require "util.set";
 local logger = require "util.logger";
@@ -370,4 +370,7 @@
 	return require"core.storagemanager".open(self.host, name or self.name, type);
 end
 
-return api;
+return function (mm)
+	modulemanager = mm;
+	return api;
+end
--- a/core/modulemanager.lua	Wed Sep 17 14:47:52 2014 +0200
+++ b/core/modulemanager.lua	Wed Sep 17 14:48:49 2014 +0200
@@ -37,7 +37,7 @@
 
 module "modulemanager"
 
-local api = _G.require "core.moduleapi"; -- Module API container
+local api = _G.require "core.moduleapi"(_M); -- Module API container
 
 -- [host] = { [module] = module_env }
 local modulemap = { ["*"] = {} };