core.modulemanager

Loading and unloading

Modulemanager is primarily responsible for handling loading of modules, setting them up with their environments, API instance and sandbox.

Plugins should normally use module:depends() when they need another module to be loaded.

load(host, module)

Loads a module onto a host and fires a module-loaded event on success.

local ok, err = modulemanager.load("example.com", "foo");
if ok then
    print("mod_foo was successfully loaded");
else
    print("mod_foo could not be loaded: " .. err);
end

reload(host, module)

unload(host, module)

is_loaded(host, module)

Returns a boolean indicating whether a module is loaded on a host.

if modulemanager.is_loaded("example.com", "foobar") then
    print("mod_foobar is loaded!")
end

load_modules_for_host(host)

Calculates all modules to be loaded on a host that has just been activated. Invoked via a host-activated event fired by hostmanager.

Invoking module methods

call_module_method(module, method, …)

module_has_method()

Module data

get_items(key, host)

get_module(host, module)

get_modules(host)