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.
Last updated