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:
parent
0b99502708
commit
10848f546e
1 changed files with 10 additions and 1 deletions
11
time.lua
11
time.lua
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue