4 local function timesort(a, b)
13 for t, e in pairs(sched) do
15 table.insert(callers, { t, e })
20 table.sort(callers, timesort)
24 for _, e in ipairs(callers) do
25 for _, v in pairs(e[2]) do
33 scripterror("schedule.lua: event is nil!")
39 function schedule(when, callback, ...)
41 local n = { callback, { ... }, tag }
42 local w = os.time() + when
45 table.insert(sched[w], n)
52 function delschedule(tag)
55 local w, o = unpack(tag)
60 for i, v in pairs(sched[w]) do
62 if #sched[w] == 1 then
72 function scheduleempty()
73 return tableempty(sched)