mirror of
https://github.com/kikito/cron.lua.git
synced 2024-12-19 18:34:20 +00:00
Timed entry removal working again
This commit is contained in:
parent
8dd3dae68b
commit
8514896b9c
6
cron.lua
6
cron.lua
@ -79,12 +79,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