Page 1 of 1

Load of modules vs rest of profile

Posted: Wed Mar 05, 2014 2:06 am
by DevArrah
So i have a bunch of mudlet modules that serve as the foundation for the rest of the profile, think a common trigger base and library functions.

however, every time i fire up mudlet, the functions and triggers that call into the function library (module) fails to load because those library functions haven;'t loaded yet. It appears as though the load order is profile -> modules.

Is there someway to jigger the load order so it loads all my modules first then the rest of the profile?

Re: Load of modules vs rest of profile

Posted: Wed Mar 05, 2014 7:05 am
by Vadi
What I do is have my modules raise an event when they are loaded, and make anything that uses them load off that event.

Re: Load of modules vs rest of profile

Posted: Wed Mar 05, 2014 11:42 am
by phasma
Yeah, pretty much what Vadi said. I posted a method on one of the other threads that you're welcome to use. In short, though, I hook onto sysLoadEvent and run a lfs.attributes() check against the system core file. If it does not exist, I raise an event, 'Serenity Installer' in this instance. If it does, then I raise 'Serenity Loader' instead.

Re: Load of modules vs rest of profile

Posted: Tue Mar 11, 2014 11:59 am
by keneanung
Vadi wrote:What I do is have my modules raise an event when they are loaded, and make anything that uses them load off that event.
Question to this approach: What happens if the module that is used finishes loading, before the using part gets a chance to register the callback?

Re: Load of modules vs rest of profile

Posted: Tue Mar 11, 2014 7:47 pm
by Vadi
The callbacks are registered via the Mudlet interface, not the function. Haven't seen any issues with this setup wherever the module is.

Also technically speaking, 'modules' are pretty much always loaded last after all the profile stuff. It is packages that get moved about.