Merge pull request #94 from oniietzschan/fix-timer-bug-shru

Timer Bug Fix - Fixed indeterminate behavior of new timers.
This commit is contained in:
Matthias Richter 2018-04-08 13:36:49 +02:00 committed by GitHub
commit dde34f98a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,14 @@ local function _nothing_() end
function Timer:update(dt) function Timer:update(dt)
local to_remove = {} local to_remove = {}
local handles = {}
local len = 0
for handle in pairs(self.functions) do for handle in pairs(self.functions) do
len = len + 1
handles[len] = handle
end
for _, handle in ipairs(handles) do
-- handle: { -- handle: {
-- time = <number>, -- time = <number>,
-- after = <function>, -- after = <function>,