[Classic]LF help with LUA
Hi everyone!
I'm trying to write my first AddOn about showing my total money and latency in game, But I notice that the total amount and latency only updated after input "/reload" in game now, here is my code, Code:
local m = CreateFrame("Frame", nil, UIParent); Code:
local bandwidthIn, bandwidthOut, latencyHome, latencyWorld = GetNetStats(); |
You need an event handler and you must tell the frame to use this handler.
Lua Code:
To update the latency you maybe need an OnUpdate script. |
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.
|
Quote:
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. |
All times are GMT -6. The time now is 08:30 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI