startglobalthread/startthread([this_table, ]function, [param, ... ])
startthread returns a unique thread id that can be used to monitor or kill the thread.
startthread(watchLight, Office.light)
tid = startthread(controlBear)
stopthread(tid)
Note that when starting a thread, you pass the name of the function and don't call the function.
startthread(watchLight(), Office.light)
This will call the function on the current thread and then probably throw an error.
If
this_table is passed, it becomes the
this for the function. This is needed for when threads are started from detached functions that need to be part of a table.
If the
startthread(...) form is used, the thread will be killed when leaving the current room