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.

1hook.tasks.once(func);
Parameter NameTypeDescription
funcfunctionThe function to execute.
Returns
None.

Executes a task once, after the given delay.

1hook.tasks.once(delay, func);
Parameter NameTypeDescription
delaynumberThe delay to wait before executing the task.
funcfunctionThe function to execute.
Returns
None.

oncef

Executes a task once, after the given delay (in frames).

1hook.tasks.once(delay, func);
Parameter NameTypeDescription
delaynumberThe delay to wait before executing the task. (in frames)
funcfunctionThe function to execute.
Returns
None.

loop

Loops a task.

1hook.tasks.loop(delay, repeats, repeat_delay, func);
Parameter NameTypeDescription
delaynumberThe delay to wait before executing the task.
repeatsnumberThe number of times to execute the task.
repeat_delaynumberThe delay to wait between task executions.
funcfunctionThe function to execute.
Returns
None.

loopf

Loops a task.

1hook.tasks.loopf(delay, repeats, repeat_delay, func);
Parameter NameTypeDescription
delaynumberThe frame delay to wait before executing the task.
repeatsnumberThe number of times to execute the task.
repeat_delaynumberThe frame delay to wait between task executions.
funcfunctionThe function to execute.
Returns
None.

coroutine Extensions

You can see the extensions to the coroutine object on the extensions documentation page.