Quantcast WoWInterface - View Single Post - [Classic]LF help with LUA
View Single Post
10-20-19, 12:41 AM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,889
Originally Posted by Kanegasi View Post
Latency data is updated somewhere around every 30 seconds to a minute. An OnUpdate for that is completely unnecessary. I suggest registering a regular event to update latency, such as UNIT_AURA or COMBAT_LOG_EVENT_UNFILTERED. Make sure this event only calls for latency, doing more with these events is a potential performance hit in combat.
Using events to update something that isn't related to is generally a bad idea. There are a ton of issues that happen depending on which data you're trying to access or even trying to update your output in a timely manner. There is no single or group of events that is guaranteed to fire every X seconds in all situations.

A more direct alternative to using OnUpdate is the C_Timer lib. C_Timer.NewTicker() wraps a function you give it and repeatedly calls C_Timer.After(). See SharedXML\C_TimerAugment.lua for Blizzard's implementation.
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 10-20-19 at 12:47 AM.
  Reply With Quote