Comparison

core/modulemanager.lua @ 6779:6236668da30a

core.*: Remove use of module() function
author Kim Alvefur <zash@zash.se>
date Sat, 21 Feb 2015 10:42:19 +0100
parent 6661:90e846e8a788
child 7162:d0b64f1e4f5d
comparison
equal deleted inserted replaced
6778:4009ae66e0f0 6779:6236668da30a
11 local config = require "core.configmanager"; 11 local config = require "core.configmanager";
12 local pluginloader = require "util.pluginloader"; 12 local pluginloader = require "util.pluginloader";
13 local set = require "util.set"; 13 local set = require "util.set";
14 14
15 local new_multitable = require "util.multitable".new; 15 local new_multitable = require "util.multitable".new;
16 local api = require "core.moduleapi"; -- Module API container
16 17
17 local hosts = hosts; 18 local hosts = hosts;
18 local prosody = prosody; 19 local prosody = prosody;
19 20
20 local xpcall = xpcall; 21 local xpcall = xpcall;
33 local component_inheritable_modules = {"tls", "saslauth", "dialback", "iq", "s2s"}; 34 local component_inheritable_modules = {"tls", "saslauth", "dialback", "iq", "s2s"};
34 35
35 -- We need this to let modules access the real global namespace 36 -- We need this to let modules access the real global namespace
36 local _G = _G; 37 local _G = _G;
37 38
38 module "modulemanager" 39 local _ENV = nil;
39 40
40 local api = _G.require "core.moduleapi".init(_M); -- Module API container 41 local load_modules_for_host, load, unload, reload, get_module, get_items, get_modules, is_loaded, module_has_method, call_module_method;
41 42
42 -- [host] = { [module] = module_env } 43 -- [host] = { [module] = module_env }
43 local modulemap = { ["*"] = {} }; 44 local modulemap = { ["*"] = {} };
44 45
45 -- Load modules when a host is activated 46 -- Load modules when a host is activated
315 else 316 else
316 return false, "no-such-method"; 317 return false, "no-such-method";
317 end 318 end
318 end 319 end
319 320
320 return _M; 321 return {
322 load_modules_for_host = load_modules_for_host;
323 load = load;
324 unload = unload;
325 reload = reload;
326 get_module = get_module;
327 get_items = get_items;
328 get_modules = get_modules;
329 is_loaded = is_loaded;
330 module_has_method = module_has_method;
331 call_module_method = call_module_method;
332 };