Hi. I'm new to lua and I'm working on my first addons. For example - I wrote simple addon that shows frame with total time spent in combat with UnitMana == UnitManaMax (tells my rogue how much energy he lost by not using any skills). It all works, but updates only on Frame1_OnEvent.
I'd like to see it updated every 0.1 second (while in combat) without calling OnEvent, like for example, timer bars do. I'm probalby looking for WoW equivalents of good old Win32 SetTimer/OnTimer functions.
How can I do it in most resource friendly way?
There is OnUpdate that fires every frame (at 10 FPS thats every 0.1 seconds). You can limit that by using the elapsed argument passed to the OnUpdate handler and only acting every 0.1 seconds
Thank you for your immediate answer. I believe that with clever disabling and enabling event listener for OnUpdate it'll be the best way to do what I need.
I'd like to see it updated every 0.1 second (while in combat) without calling OnEvent, like for example, timer bars do. I'm probalby looking for WoW equivalents of good old Win32 SetTimer/OnTimer functions.
How can I do it in most resource friendly way?
Thanks for any assist.