Skip to content

Commit

Permalink
Timer - Fixed bug where behaviour of new timers added during iteratio…
Browse files Browse the repository at this point in the history
…n through timer handles was indeterminate.
  • Loading branch information
oniietzschan committed Feb 16, 2018
1 parent 945423f commit e62e699
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions timer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ local function _nothing_() end
function Timer:update(dt)
local to_remove = {}

local handles = {}
local len = 0
for handle in pairs(self.functions) do
len = len + 1
handles[len] = handle
end

for _, handle in ipairs(handles) do
-- handle: {
-- time = <number>,
-- after = <function>,
Expand Down

0 comments on commit e62e699

Please sign in to comment.