From 8a38b5d0da79c6177ba4c2523e72505b3937df7c Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 30 Nov 2023 10:09:47 +0000 Subject: modulemanager: Allow modules to expose module.ready - to be called after init This is a shortcut for module:on_ready() which exposes the functionality in an idiomatic way consistent with module.load, module.unload, etc. module.ready runs when the module is loaded and the server has finished starting up. --- core/modulemanager.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/modulemanager.lua b/core/modulemanager.lua index 00ceedbc..873e08e5 100644 --- a/core/modulemanager.lua +++ b/core/modulemanager.lua @@ -293,6 +293,10 @@ local function do_load_module(host, module_name, state) ok, err = do_load_module(host, module_name); end end + + if module_has_method(pluginenv, "ready") then + pluginenv.module:on_ready(pluginenv.module.ready); + end end if not ok then modulemap[api_instance.host][module_name] = nil; -- cgit v1.2.3