View Single Post
01-26-23, 02:21 AM   #17
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 323
That's true. Thanks for pointing it out.
In fact, it seems that the registered functions are executed in the order they have been registered. So it is not possible to make sure you are first by waiting with the registration.


Lua Code:
  1. local startupFrame = CreateFrame("Frame")
  2. startupFrame:RegisterEvent("PLAYER_LOGIN")
  3. startupFrame:SetScript("OnEvent", function(self, event, ...)
  4.  
  5.   TooltipDataProcessor.AddTooltipPreCall(Enum.TooltipDataType.Item, function(self)
  6.     print("Registered first.")
  7.   end)
  8.  
  9.   C_Timer.After(3.0, function()
  10.     TooltipDataProcessor.AddTooltipPreCall(Enum.TooltipDataType.Item, function(self)
  11.       print("Registered after 3 seconds.")
  12.     end)
  13.   end)
  14.  
  15.   C_Timer.After(5.0, function()
  16.     TooltipDataProcessor.AddTooltipPreCall(Enum.TooltipDataType.Item, function(self)
  17.       print("Registered after 5 seconds.")
  18.     end)
  19.   end)
  20.  
  21. end)

Printed result is:
Registered first.
Registered after 3 seconds.
Registered after 5 seconds.
__________________
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote