Subclass of {@link LuaValue} that implements a lua coroutine thread using Java Threads.
A LuaThread is typically created in response to a scripted call to {@code coroutine.create()}
The threads must be initialized with the globals, so that the global environment may be passed along according to rules of lua. This is done via a call to {@link #setGlobals(LuaValue)} at some point during globals initialization. See {@link BaseLib} for additional documentation and example code.
The utility classes {@link JsePlatform} and {@link JmePlatform} see to it that this initialization is done properly. For this reason it is highly recommended to use one of these classes when initializing globals.
The behavior of coroutine threads matches closely the behavior of C coroutine library. However, because of the use of Java threads to manage call state, it is possible to yield from anywhere in luaj. On the other hand, if a {@link LuaThread} is created, then yields without ever entering a completed state, then the garbage collector may not be able to determine that the thread needs to be collected, and this could cause a memory and resource leak. It is recommended that all coroutines that are created are resumed until they are in a completed state.
@see LuaValue
@see JsePlatform
@see JmePlatform
@see CoroutineLib