Function timing
Hi!
I would like to execute timed functions. Only wow lua support i found until now: "OnUpdate" event. Is there something else what is not based on graphical engine? Thank you, |
Unless you're getting 2 FPS, and even then for most purposes, it doesn't really matter that OnUpdate is tied to your framerate:
Code:
local t = 5 -- do something 5 seconds from now Code:
local f = CreateFrame("Frame") In WoD the game will provide an actual timer mechanism, but the primary benefit to using it will likely be in reducing the amount of code that needs to be written to implement a timer, rather than offering any tangible performance boost: Code:
C_Timer.After(5, function() |
C_Timer would most likely be better for performance too, but no benchmarks have been done yet.
|
I would think C_Timer.After() would be easier on resources since you won't have to create any UI objects to use. The only problem is you'll need to manage setting it up again if you want something to keep calling every so many seconds if you don't want to use Blizzard's Lua-defined Ticker factories (C_Timer.NewTicker() and C_Timer.NewTimer()). Note the Ticker factories return a table hooked into a metatable to control the ability to cancel a timer with entries for remaining iteration counts, a cancel flag, and a dynamicly-created callback function that is passed to C_Timer each iteration. This creates significantly more overhead than using C_Timer.After() yourself.
|
Quote:
|
Thank you for tipps. I think, i keep OnUpdate.
|
All times are GMT -6. The time now is 09:23 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI