Changeset

13361:e20949a10118

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.
author Matthew Wild <mwild1@gmail.com>
date Thu, 30 Nov 2023 10:09:47 +0000
parents 13360:6037b7a2131c
children 13362:11e66ad894f0
files core/modulemanager.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/core/modulemanager.lua	Thu Nov 30 10:07:53 2023 +0000
+++ b/core/modulemanager.lua	Thu Nov 30 10:09:47 2023 +0000
@@ -293,6 +293,10 @@
 				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;