scheduler
INFO
Анықтаманың өзі ағылшын тілінде: ол WIT файлдарынан автоматты түрде жасалады.
Delayed and repeating tasks. Times are in ticks: one tick is one world step (0.2 s on the server). The host calls guest.run-task on the main thread when a task is due.
Package blockheads:api@0.3.1 · Lua table bh.scheduler · WIT source
Uses: types.{api-error}
Types
task-id type
txt
type task-id = u64;Identifies one task of the calling mod.
Functions
run-later function
txt
run-later: func(delay: u32) -> result<task-id, api-error>;Runs once after delay ticks (0 = at the next tick).
run-every function
txt
run-every: func(delay: u32, period: u32) -> result<task-id, api-error>;Runs after delay ticks and then every period ticks (period >= 1) until cancelled.
run-next-poll function
txt
run-next-poll: func() -> result<task-id, api-error>;Runs once in the next network poll (about 16 ms), for quick replies to players.
cancel function
txt
cancel: func(id: task-id) -> bool;Cancels a task. Returns false if it did not exist or already ran.