mirror of
https://github.com/kikito/cron.lua.git
synced 2024-12-19 18:34:20 +00:00
Merge branch 'master' of https://github.com/hahawoo/cron.lua
This commit is contained in:
commit
b855d79bb9
6
cron.lua
6
cron.lua
@ -84,12 +84,8 @@ end
|
|||||||
function cron.update(dt)
|
function cron.update(dt)
|
||||||
assert(type(dt) == "number" and dt >= 0, "dt must be a non-negative number")
|
assert(type(dt) == "number" and dt >= 0, "dt must be a non-negative number")
|
||||||
|
|
||||||
local expired = {}
|
|
||||||
for id, entry in pairs(entries) do
|
for id, entry in pairs(entries) do
|
||||||
if entry:update(dt) then expired[id] = true end
|
if entry:update(dt) then entries[id] = nil end
|
||||||
end
|
|
||||||
for id,_ in pairs(expired) do
|
|
||||||
entries[id] = nil
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user