ackfuss-4.4.1/
ackfuss-4.4.1/board/
ackfuss-4.4.1/help/k/
ackfuss-4.4.1/help/n/
ackfuss-4.4.1/help/s/
ackfuss-4.4.1/help/u/
ackfuss-4.4.1/help/v/
ackfuss-4.4.1/help/x/
ackfuss-4.4.1/help/y/
ackfuss-4.4.1/help/z/
ackfuss-4.4.1/src/areaconvert/
ackfuss-4.4.1/src/areaconvert/h/
module("wait", package.seeall)

local threads = {}

function wait.update ()

  -- for each active thread, see if the time is up
  
  for k, v in pairs (threads) do
    if os.time () >= v then
      threads [k] = nil  -- delete from table now
      assert (coroutine.resume (k))
    end
  end
end

function wait.pause (seconds)
  threads [assert(coroutine.running(),"Not in coroutine!")] = os.time () + (seconds or 1)
  return coroutine.yield ()
end

function wait.make (f)
  assert (type (f) == "function", "wait.make requires a function")
  coroutine.wrap (f) () -- make coroutine, resume it
end -- make

return wait