Yuari
Documentation
Docs/task library

task library

The Roblox-style task scheduler, backed by the external VM's own tick loop.

Yields for seconds (default 0.03).

task.wait(0.5)

Runs fn on a new thread immediately.

task.spawn(function()
    print("spawned")
end)

Schedules fn to run after seconds. Returns a handle usable with task.cancel.

local handle = task.delay(1, function()
    print("delayed")
end)
print(handle)

Runs fn as soon as the current thread yields.

task.defer(function()
    print("deferred")
end)

Cancels a thread or a task.delay handle.

local handle = task.delay(5, function()
    print("never runs")
end)
task.cancel(handle)

Compatibility no-ops. The external VM runs scripts on a single Lua state, so both return immediately.

task.synchronize()
-- do work
task.desynchronize()