dreamworkAPI
Ctrl K
GitHub
libraryDocs / coroutine

coroutine

librarysharedmenusource

coroutine library

Coroutines are similar to threads, however they do not run simultaneously.

They offer a way to split up tasks and dynamically pause & resume functions.

Functions

coroutine.isyieldableReturns true when the running coroutine can yield.
coroutine.running
coroutine.waitRepeatedly yields the coroutine for the given duration before continuing.

#coroutine.isyieldable

sharedmenunodiscardsource
function coroutine.isyieldable(): boolean

Returns true when the running coroutine can yield.

View documents

Returns
TypeNameDescription
booleanis_yieldable

#coroutine.running

function coroutine.running(): running
Returns
TypeNameDescription
running

#coroutine.wait

sharedmenuasyncsource
async function coroutine.wait(seconds: number)

Repeatedly yields the coroutine for the given duration before continuing.

Parameters
NameTypeDescription
secondsnumber
Generated from the dreamwork meta branch.