coroutine
Coroutines are similar to threads, however they do not run simultaneously. They offer a way to split up tasks and dynamically pause & resume functions.
Methods
boolean coroutine.isyieldable()
Returns whether the running coroutine can yield.
A running coroutine is yieldable if it is not in the main thread, and it is not inside a non-yieldable CÂ function.
This is only available on the x86-64 versions, because of the difference in the LuaJIT version. See here
Resumes the given coroutine and passes the given vararg to either the function arguments or the coroutine. yield that is inside that function and returns whatever yield is called with the next time or by the final return in the function.
Returns the status of the coroutine passed to it, the possible statuses are "suspended", "running", and "dead".
Repeatedly yields the coroutine for the given duration before continuing.
Only works inside a coroutine. Only useful in nextbot coroutine think function.
This function uses CurTime instead of RealTime.
Returns a function which calling is equivalent with calling coroutine. resume with the coroutine and all extra parameters.
The values returned by the returned function only contain the values passed to the inner coroutine. yield call and do not include the no error status that coroutine. resume provides. In case of failure, an error is thrown instead.