Originally Posted by Layback_
So, do "TokenFrame_Update" function and "CURRENCY_DISPLAY_UPDATE" event get called simultaneously?
|
That question doesn't make any sense. Events don't
get called. Events
fire (that is to say, they are emitted by the game, and that action occurs in the underlying C code, not in the Lua code that creates and controls the UI) and UI code can listen for events and call functions in response to them.
If you're asking whether the UI calls TokenFrame_Update in response to CURRENCY_DISPLAY_UPDATE,
the answer now appears to be yes, which means I could probably use an event handler instead of hooking functions in my addon if I wanted to bother changing it. Like I said, I don't recall why I used that solution when I wrote my addon 8 years ago.
That also means that the answer to your original question is probably that
the best solution here is to listen for the CURRENCY_DISPLAY_UPDATE event. If you try that, and are seeing currency numbers changing without the event firing, report back with a description of the circumstances.
Lua Code:
local f = CreateFrame("Frame")
f:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
f:SetScript("OnEvent", function(f, e, ...)
print(e, ...)
end)