utils

Functions:

run_timer

utils.run_timer(delay: number, period: number, callback: function[, ...]): number

Name
Type
Description

delay

number

Initial delay before executing the callback function in seconds.

period

number

Interval time between executing callback functions in seconds.

callback

function

Lua function to execute.

...

any

Additional arguments that will be passed to the callback function.

Creates a timer for repeated execution. Returns a task ID.

run_timer_once

utils.run_timer(delay: number, callback: function[, ...]): number

Name
Type
Description

delay

number

Delay before executing the callback function in seconds.

callback

function

Lua function to execute.

...

any

Additional arguments that will be passed to the callback function.

Create a single execution timer. Returns a task ID.

This task will automatically clean up after execution and does not require manual cancellation, but you can cancel it before execution.

cancel_timer

utils.cancel_timer(taskid: number): boolean

Name
Type
Description

taskid

number

Task ID to be cancelled.

Cancels the specified timer task. Returns false only when an exception is thrown.

This means that even if the task does not exist, it will still return true.

Last updated