> For the complete documentation index, see [llms.txt](https://aup.nomi.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aup.nomi.dev/built-in/task/apis.md).

# APIs

This page provide API functions of Task module.

## .run

`task.run(routine: fn, args: arr) -> ptr`

Execute a function in parallel.

#### Parameters (2)

`routine`

A function to be executed.

`args`

Parameters pass to the routine function.

#### Return value

## .do

`task.do(function: fn, delay: num) -> ptr`

Call a function, with a delay time.

#### Parameters (2)

`function`

A zero-parameter function to be executed.

`delay`

Delay time in milliseconds.

#### Return value

Identifier of a timer.

## .sched

`task.sched(function: fn, delay: num) -> ptr`

Call a function repeatedly, with a fixed time delay between each call.

#### Parameters (2)

`function`

A zero-parameter function to be executed.

`delay`

Delay time in milliseconds.

#### Return value

Identifier of a timer.

## .clear

`task.clear(id: ptr) -> bool`

Clear a given task/timer identifier.

#### Parameters (1)

`id`

Task/timer identifier.

#### Return value

True if success, else false.

## .wait

`task.wait(id: ptr)`

Wait until the task/timer is finished.

#### Parameters (1)

`id`

Identifier of task/timer.

#### Return value

None.
