Create New Thread

threado = thread.new(function, [name], [timeout_ms])

Create a new thread object.

The Lua function will be the entry point of the thread, with the optional Lua timeout value (in milliseconds).

Both the thread object and the name are passed to the function:

function ThreadOne(the_thread, the_name)
  while the_thread:run()
  do
    -- work
  end
end

local my_thread = thread.new(ThreadOne, 'SampleThread')