thread

thread.thread.dispatch

Declaration
lua
thread.dispatch(task [, on_error])
Description
Run function in a new thread.
Parameters
`task` (function) — function to execute `on_error` (function, optional) — error handler
Return Values
`number` — thread ID
Example
lua
local tid = thread.dispatch(function()
  sys.log('running in thread')
  sys.sleep(1)
end)