Module task

Task functions

Functions

create(f[, priority[, stack_size]]) Creates a new task.
yield(duration) Yields execution of this script to other tasks and event handlers (also from the same script).


Functions

create(f[, priority[, stack_size]])
Creates a new task. It will begin executing when you return or call task.yield()

Parameters:

  • f function the function to run
  • priority int (optional)
  • stack_size int (optional)
yield(duration)
Yields execution of this script to other tasks and event handlers (also from the same script).

FIXME: once a task executed yield(), other tasks or event handlers from the same script, that might interrupt the former, must not execute yield(). Otherwise, an error will be thrown to prevent memory corruption, camera lockup or worse.

The above limitation is a very dirty hack - a proper fix should be implemented by somebody familiar with multitasking in Lua. Help is more than welcome, as this topic is not exactly our cup of tea.

TODO: replace with msleep?

Parameters:

  • duration int how long to sleep for in ms.
generated by LDoc 1.4.3 Last updated 2017-09-02 23:31:52