I am very much more concerned in my projects with the passage of time than with the current clock. Presently, this obliges me to track the last time my listeners were triggered externally, and calculate the difference to subtract it from another persistent value that indicates how much more time I have to wait. (Storing next-fire times instead of remaining waits is awkward as well.)
It would save me a lot of time to receive the time elapsed since the last enterFrame dispatch as an additional field on the event table. Alternatively, an API to get the current frame rate might suffice. I can also implement this function myself given two things I am not currently certain of; that listeners are fired in the order they were added, and that the table passed to listeners as the event argument is reused. In that case I could save [lua]local tPrime = system.getTimer()
Runtime:addEventListener(‘enterFrame’,
function(event)
event.elapsed, tPrime = event.time - tPrime, event.time
end
)[/lua] to something like “enterFrame.elapsed.lua” and preface my main.lua file with “require ‘enterFrame.elapsed’”.
If those conditions are guaranteed (calling order of listeners and reuse of event tables), then this request drops in priority significantly. [import]uid: 12678 topic_id: 5024 reply_id: 305024[/import]