HookScript mystery??
Can anybody explain the logic of this behaviour??
I am hooking OnTooltipSetItem and OnTooltipCleared of GameTooltip at two different times: when loading the addon and again with a 1 second delay: Code:
GameTooltip:HookScript("OnTooltipSetItem", function() print("INIT >> SetItem") end) Code:
INIT >> SetItem But what I don't understand is why the "INIT" prints get executed first for BOTH SetItem and Cleared, and only then the "WAIT" prints get executed but in the opposite order (first Cleared then SetItem)? I would have expected that INIT and WAIT are always executed one after the other. So what does it matter if I set the hook when loading the addon or with a delay? |
May be the first thing when Setitem fires is that it calls a clear for the tooltip?
|
OK, I think my working example was not the best way to demonstrate it.
Let me put it this way: Code:
GameTooltip:HookScript("OnTooltipSetItem", function() print(GetTime(), "SetItem") end) Code:
1225.517 SetItem Whereas, Code:
C_Timer.After(1, function() Code:
1340.647 Cleared |
So, this is interesting:
I disabled all other addons, and now I get the same for both cases: Code:
1551.817 SetItem |
Quote:
If that goes first, it's like: Code:
GameTooltip:HookScript("OnTooltipSetItem", function(self) Code:
3679.479 Cleared If it comes second, it's like: Code:
GameTooltip:HookScript("OnTooltipSetItem", function() print(GetTime(), "SetItem") end) Code:
4264.37 SetItem |
All times are GMT -6. The time now is 07:47 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI