Owl.Util.Scheduler:Add(fn: TaskFn, opts?: TaskOptions): TaskHandle

Server & Client

Enqueues a one-time or custom task into the main Heartbeat task queue, respecting the frame budget.

Parameters

fn*Callback function receiving delta time (dt). Returning true cancels the task.
optsOptional configuration object for Priority, Delay, Repeat or BudgetCost.

Returns

TaskHandleHandle object used to inspect or cancel the task at runtime.

Related Types

local handle = Owl.Util.Scheduler:Add(function(dt)
    print("Executing delayed task after", dt, "seconds")
end, {
    Delay = 5,
    Priority = 1,
})