Thread Tools Display Modes
09/17/17, 08:30 AM   #1
rockingdice
 
rockingdice's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2017
Posts: 10
Addons loading order

I'm not sure if the order to load add-ons obey some rules? Or just random?
It seems my add-on is good in my environment, but not all of the others. And I think the reason is my codes run before theirs (Mine will hook the other addon's function)

Same add-ons and data unrelated, so I'm pretty sure is the loading order is different.

How to ensure mine is loaded after the one I hooked?
  Reply With Quote
09/17/17, 08:52 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Check the manifest txt file in your addon folder and use the directives

Code:
##DependsOn
##OptionalDependsOn
put each addon name behind the directive line, with a splitting space, to assure that these addon names/library names get loaded BEFORE your addon's ON_LOAD event gets started.

e.g.

Code:
## OptionalDependsOn: libFilters-2.0 LibAddonMenu-2.0 ResearchAssistant SousChef VotansSettingsMenu PotionMaker CraftedPotions ChatMerchant InventoryGridView CraftBagExtended SetTracker AdvancedDisableControllerUI DetailedResearchScrolls
Inside your OnLoad event callback function you are able to check the addonName == "Other addon name" or if a global variable of the other addon exists you can check this by using something like

Lua Code:
  1. --Is the addon "abc" is loaded yet?
  2. if ABC ~= nil and ABC.functioName ~= nil then
  3. --Addon abc is loaded and function functioName exists.
  4. --Call the function now
  5. ABC.functionName()
  6. end
  Reply With Quote
09/17/17, 09:10 AM   #3
rockingdice
 
rockingdice's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2017
Posts: 10
Originally Posted by Baertram View Post
Check the manifest txt file in your addon folder and use the directives

Code:
##DependsOn
##OptionalDependsOn
put each addon name behind the directive line, with a splitting space, to assure that these addon names/library names get loaded BEFORE your addon's ON_LOAD event gets started.

e.g.

Code:
## OptionalDependsOn: libFilters-2.0 LibAddonMenu-2.0 ResearchAssistant SousChef VotansSettingsMenu PotionMaker CraftedPotions ChatMerchant InventoryGridView CraftBagExtended SetTracker AdvancedDisableControllerUI DetailedResearchScrolls
Inside your OnLoad event callback function you are able to check the addonName == "Other addon name" or if a global variable of the other addon exists you can check this by using something like

Lua Code:
  1. --Is the addon "abc" is loaded yet?
  2. if ABC ~= nil and ABC.functioName ~= nil then
  3. --Addon abc is loaded and function functioName exists.
  4. --Call the function now
  5. ABC.functionName()
  6. end
Thank you, I'll try it!
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Addons loading order

Thread Tools
Display Modes

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