Module task

Task functions

Functions

create(f[, priority[, stack_size[, disable_powersave=false]]]) 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[, disable_powersave=false]]])
Creates a new task. It will begin executing when you return or call task.yield().

Tasks spawned from Lua can optionally run with powersaving disabled (so the camera won't turn off while running them) if you enable disable_powesave (for example, task.create(my_func, nil, nil, true)).

Parameters:

  • f function the function to run
  • priority int DryOS task priority (0x1F = lowest priority; lower values = higher priority; default 0x1C) (optional)
  • stack_size int Memory reserved for this task to be used as stack (default 0x10000) (optional)
  • disable_powersave bool Set to true to prevent the camera from turning off while running this task. (default false)
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 2018-03-31 18:16:09