1
0
Fork 0
mirror of https://github.com/Reuh/ubiquitousse.git synced 2025-10-27 09:09:30 +00:00

Fix TimeRegistry problems

This commit is contained in:
Reuh 2016-04-29 17:07:55 +02:00
parent 0b99502708
commit 10848f546e

View file

@ -47,12 +47,15 @@ local function newTimerRegistry()
end
end
local done = {} -- functions done running
local d = delayed
for func, t in pairs(d) do
local co = t.coroutine
t.after = t.after - dt
if t.after <= 0 then
d[func] = nil
d[func] = false -- niling here cause the next pair iteration to error
table.insert(done, func)
if not co then
co = coroutine.create(func)
t.coroutine = co
@ -80,6 +83,12 @@ local function newTimerRegistry()
end
end
end
for _, func in ipairs(done) do
if not d[func] then
d[func] = nil
end
end
end,
--- Schedule a function to run.