|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).|
- create(f[, priority[, stack_size]])
Creates a new task. It will begin executing when you return or call task.yield()
- f function the function to run
- priority int (optional)
- stack_size int (optional)
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?
- duration int how long to sleep for in ms.