Skip to content
AEOWUN
Docs Menu

Scheduled Tasks [BETA]

Run or delay functions with the script scheduler.

Schedule gameplay callbacks

The task namespace uses AeoScript's cooperative scheduler. It does not create operating-system threads.

  • task.spawn(callback) schedules a function.
  • task.defer(callback) schedules a function for a later script step.
  • task.delay(seconds, callback) waits at least the requested non-negative interval before running the function.
task.defer(fn() {
    debug.log("Next script step")
})

task.delay(2, fn() {
    debug.log("Two seconds later")
})

Callbacks must be functions. Invalid delay values produce a runtime error.

Next: Task API · Waiting