Skip to content

Coroutine

The Coroutine library offers coroutines that support sleeping for X seconds or until a predicate is met.

CoroutineLib Class

Inherits from Library.

Methods

Create
function CoroutineLib.Create(fun)
   -> CoroutineInstance

@param fun fun(inst:CoroutineInstance, ...)

CoroutineInstance Class

Events and Hooks

Finished (event)

Methods

Continue
function CoroutineInstance:Continue()
   -> ...
IsDead
function CoroutineInstance:IsDead()
   -> boolean
IsSleeping
function CoroutineInstance:IsSleeping()
   -> boolean
Sleep
function CoroutineInstance:Sleep(time, ...)

@param time number|function

@param ... any Variables yielded. Discarded if the coroutine is resuming from sleeping, as there is no caller.

Yield

function CoroutineInstance:Yield()