Coroutines are similar to threads, however they do not run simultaneously. They offer a way to split up tasks and dynamically pause & resume functions.
boolean, vararg coroutine.resume( thread coroutine, vararg args )
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.
string coroutine.status( thread coroutine )
Returns the status of the coroutine passed to it, the possible statuses are "suspended", "running", and "dead".
coroutine.wait( number duration )
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.
function coroutine.wrap( function coroutine )
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.