Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How does Coroutine work?

'I wanted to ask this, this was meant to be asked before but forgotten'

I dont how how coroutine works, nor how it is used for what. I know there is coroutine.create(coroutine.resume(function(), but I dont know how it works, nor how to use it.

1 answer

✓ Accepted answer

To start with, here is the function dump for the coroutine table in ROBLOX.

Coroutines are, simply put, "threads" of Lua code that can be run concurrently with other threads. This enables you to, for example, run two different loops at the same time. A "thread" is also created for each individual Script, although you cannot directly access a Script's thread as you can a coroutine.

You can look into the actual functions in the above function dump, and check out this tutorial if you are still stuck with actually using them.

1 comment

0

Thanks man! That explains allot! :)

This discussion is preserved as it was. New answers, comments, and votes are closed.