Thread Tools Display Modes
Prev Previous Post   Next Post Next
01/19/21, 03:47 PM   #1
QuantumPie
AddOn Author - Click to view addons
Join Date: Sep 2019
Posts: 32
How do hooks behave if two addons modify the original?

For the achievement addon I'm developing, I'm hooking into some functions via:
Lua Code:
  1. local orgLayoutAchievements = ACHIEVEMENTS.LayoutAchievements
  2. function ACHIEVEMENTS:LayoutAchievements(achievements)
  3.     addon.achievementPool:ReleaseAllObjects()
  4.     ZO_ClearTable(self.achievementsById)
  5.     ZO_Scroll_ResetToTop(addon.contentList)
  6.  
  7.     local previous
  8.     for i = 1, #achievements do
  9.         local id = achievements[i]
  10.         if ZO_ShouldShowAchievement(self.categoryFilter.filterType, id) then
  11.             local achievement = addon.achievementPool:AcquireObject()
  12.             local baseAchievementId = self:GetBaseAchievementId(id)
  13.             self.achievementsById[baseAchievementId] = achievement
  14.             --  i here is the same as the achievementIndex for the achievement
  15.             achievement:SetIndex(i)
  16.  
  17.             achievement:Show(ZO_GetNextInProgressAchievementInLine(id))
  18.  
  19.             achievement:SetAnchoredToAchievement(previous)
  20.             previous = achievement
  21.         end
  22.     end
  23.  
  24.     orgLayoutAchievements(self, achievements)
  25. end

If a second addon was to hook into this function, how would it behave? I'm assuming whichever one is loaded last becomes the defacto implementation. I initially used ZO_PreHook but for some reason switched to the method above for later hooks. Do both methods behave the same with a 2nd addon hooking into it?
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » How do hooks behave if two addons modify the original?


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