aboutsummaryrefslogtreecommitdiffstats
path: root/core/modulemanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2022-02-04 14:11:46 +0000
committerMatthew Wild <mwild1@gmail.com>2022-02-04 14:11:46 +0000
commit4bdff5a4529443c19df04f16ee35939ef324f516 (patch)
tree5afea32ca250c285372ed73754c42ddeb78020a5 /core/modulemanager.lua
parentfdfaff07e0a21e457e6c206c9e269f63efcac256 (diff)
downloadprosody-4bdff5a4529443c19df04f16ee35939ef324f516.tar.gz
prosody-4bdff5a4529443c19df04f16ee35939ef324f516.zip
modulemanager, moduleapi: Switch to new pluginloader interface
Diffstat (limited to 'core/modulemanager.lua')
-rw-r--r--core/modulemanager.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 03dd60a6..436ee378 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -52,6 +52,9 @@ local _G = _G;
local _ENV = nil;
-- luacheck: std none
+local loader = pluginloader.init({
+});
+
local load_modules_for_host, load, unload, reload, get_module, get_items;
local get_modules, is_loaded, module_has_method, call_module_method;
@@ -184,7 +187,7 @@ local function do_load_module(host, module_name, state)
local pluginenv = setmetatable({ module = api_instance }, { __index = _G });
api_instance.environment = pluginenv;
- local mod, err = pluginloader.load_code(module_name, nil, pluginenv);
+ local mod, err = loader:load_code(module_name, nil, pluginenv);
if not mod then
log("error", "Unable to load module '%s': %s", module_name or "nil", err or "nil");
api_instance:set_status("error", "Failed to load (see log)");
@@ -271,7 +274,7 @@ local function do_reload_module(host, name)
local mod = get_module(host, name);
if not mod then return nil, "module-not-loaded"; end
- local _mod, err = pluginloader.load_code(name); -- checking for syntax errors
+ local _mod, err = loader:load_code(name); -- checking for syntax errors
if not _mod then
log("error", "Unable to load module '%s': %s", name or "nil", err or "nil");
return nil, err;
@@ -395,4 +398,6 @@ return {
is_loaded = is_loaded;
module_has_method = module_has_method;
call_module_method = call_module_method;
+
+ loader = loader;
};