tasks
The tasks
namespace contains functions used to run concurrent functions (coroutines). These functions operate similar to Lua’s built in coroutines but offer a bit more flexibility on how they work. daochook also extends the built-in coroutine table to include additional functions.
Functions exposed by this namespace are accessed via the prefix: hook.tasks.
Functions
once
Executes a task once.
Parameter Name | Type | Description |
---|
func | function | The function to execute. |
Executes a task once, after the given delay.
1hook.tasks.once(delay, func);
Parameter Name | Type | Description |
---|
delay | number | The delay to wait before executing the task. |
func | function | The function to execute. |
oncef
Executes a task once, after the given delay (in frames).
1hook.tasks.once(delay, func);
Parameter Name | Type | Description |
---|
delay | number | The delay to wait before executing the task. (in frames) |
func | function | The function to execute. |
loop
Loops a task.
1hook.tasks.loop(delay, repeats, repeat_delay, func);
Parameter Name | Type | Description |
---|
delay | number | The delay to wait before executing the task. |
repeats | number | The number of times to execute the task. |
repeat_delay | number | The delay to wait between task executions. |
func | function | The function to execute. |
loopf
Loops a task.
1hook.tasks.loopf(delay, repeats, repeat_delay, func);
Parameter Name | Type | Description |
---|
delay | number | The frame delay to wait before executing the task. |
repeats | number | The number of times to execute the task. |
repeat_delay | number | The frame delay to wait between task executions. |
func | function | The function to execute. |
coroutine
Extensions
You can see the extensions to the coroutine
object on the extensions documentation page.