v0.13.7
errors and warnings / debugging

errors and warnings / debugging / P7102

P7102 hint

An OnUpdate script runs every frame, also while its frame is hidden; use every from wowlua:timer, or clear the script on hide

area
debugging (x7xxx)
fails the build
no

A performance hint from the dev window, not the compiler. An OnUpdate script ran in nearly every frame while its frame showed nothing: the frame has no size or is fully transparent, as a frame made only to run code usually is. OnUpdate runs once per rendered frame, 60 to 240 times a second, for as long as the frame is shown, so a script that only waits or polls costs time in every frame.

When the work is needed every few tenths of a second, use every or repeating from wowlua:timer instead, which run on C_Timer and cost nothing in between. When the script only matters while some UI is open, set it in that UI's OnShow and clear it with SetScript("OnUpdate", nil) in OnHide, or hide the frame that carries it.

codemessage
P7101A handler runs very often in a recording (bursts of the same event); collapse bursts with @throttle from wowlua:timer

Offline

terminal
$ wowlua explain P7102
P7102 (hint): An OnUpdate script runs every frame, also while its frame is hidden; use every from wowlua:timer, or clear the script on hide

source on GitHub ↗