ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Addons loading order (https://www.esoui.com/forums/showthread.php?t=7362)

rockingdice 09/17/17 08:30 AM

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?

Baertram 09/17/17 08:52 AM

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

rockingdice 09/17/17 09:10 AM

Quote:

Originally Posted by Baertram (Post 32645)
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!


All times are GMT -6. The time now is 12:37 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI