Thread Tools Display Modes
Prev Previous Post   Next Post Next
07/16/24, 01:53 AM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,102
The load order is defned via the ## DependsOn and ## OptionalDependsOn, regardless if an addon or library, in all txt files of all "addons".
All "addons" (each txt manifest file so to say) gets into the load order before all run through the EVENT_ADD_ON_LOADED in that order then.
And all "addons" fire their EVENT_ADD_ON_LOADED in that load order too.

If your addon needs a library as must have use ## DependsOn: LibraryName>=LibraryVersion (in the libraries ttx file, the tag ## AddOnVersion) and that assures your addon cannot load if that dependency is missing OR using an old version smaller then LibraryVersion!

If it optionally needs it use ## OptionalDependsOn: LibraryName=>LibraryVersion

Same works for any addon.

At the EVENT_ADD_ON_LOADED, as YOUR addon's name is found then in that loop over all addons, you can be sure the global variable LibLibraryName exists alread as it was loaded before your addon.
Same for all other addons, so if your addon optionally depends on OtherAddon1 the global variable OtherAddon1 exists as your addon loads (if that addon got a global variable).
And else you can always check in the EVENT_ADD_ON_LOADED if any addonName was loaded there, to find out if the other addon loaded already before your addon (or even after your addon if you do not unregister that event in your addon code!).


Attention:
EVENT_ADD_ON_LOADED must not always mean the other addon or library has finished preparing!
Always check the description and API of these addons and libraries, sometimes they provide a function you need to use to check if they are ready.
Some addons e.g. are ready at EVENT_PLAYER_ACTIVATED first, and some libraries start to do stuff at EVENT_ADD_ON_LOADED and finally fire a callback that your can use via CALLBACK_MANAGER or ThatOtherLibraryGlobal:APIFunctionIfLibIsReady() or ThatOtherLibraryGlobal.isLibReady boolean...

Last edited by Baertram : 07/16/24 at 02:00 AM.
  Reply With Quote
 

ESOUI » Developer Discussions » General Authoring Discussion » Tables vs Objects Help


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off