Meer informatie
Engine-bibliotheek
coroutine

*Deze inhoud is vertaald met behulp van AI (bèta) en kan fouten bevatten. Klik hier om deze pagina in het Engels te bekijken.


Samenvatting

Functies
close(co: coroutine):boolean,Variant<string, ()>
finally(co: coroutine,callback: Variant)
resume(co: coroutine,...: Variant):boolean,Variant<Tuple, string>
yield(...: Tuple):Tuple<Variant>

API-referentie
Functies
close
coroutine.close(co:coroutine):boolean,Variant<string, ()>
Parameters
Teruggaves
boolean, Variant<string, ()>
Codevoorbeelden
Coroutine Sluiten

create
coroutine.create(f:function):coroutine
Parameters
Teruggaves
Codevoorbeelden
Coroutine Aanmaken

finally
coroutine.finally(
co:coroutine, callback:Variant)
Parameters
callback:Variant
Codevoorbeelden
Coroutine Eindelijk
local function observe(co, label)
coroutine.finally(co, function(status, ...)
print(label, status, ...)
end)
end
local finishing = coroutine.create(function()
return "result"
end)
observe(finishing, "finishing") --> finishing voltooid resultaat
coroutine.resume(finishing)
local failing = coroutine.create(function()
error("boom", 0)
end)
observe(failing, "failing") --> falen fout boom
coroutine.resume(failing)
local cancelled = coroutine.create(function()
coroutine.yield()
end)
coroutine.resume(cancelled)
observe(cancelled, "cancelled") --> geannuleerd geannuleerd
coroutine.close(cancelled)

isyieldable
coroutine.isyieldable():boolean
Teruggaves
Codevoorbeelden
Coroutine Is Yieldable

resume
coroutine.resume(
co:coroutine, ...:Variant
):boolean,Variant<Tuple, string>
Parameters
...:Variant
Teruggaves
boolean, Variant<Tuple, string>
Codevoorbeelden
Coroutine Hervatten

running
coroutine.running():coroutine
Teruggaves
Codevoorbeelden
Coroutine Uitvoering

status
coroutine.status(co:coroutine):string
Parameters
Teruggaves
Codevoorbeelden
Coroutine Status

wrap
coroutine.wrap(f:function):function
Parameters
Teruggaves
Codevoorbeelden
Coroutine Wrap

yield
coroutine.yield(...:Tuple):Tuple<Variant>
Parameters
...:Tuple
Teruggaves
Tuple<Variant>
Codevoorbeelden
Coroutine Yield

©2026 Roblox Corporation. Roblox, het Roblox-logo en Powering Imagination behoren tot onze geregistreerde en niet-geregistreerde handelsmerken in de VS en andere landen.