Still have questions? Join our Discord server and get real time help.
Log in to vote

How does Coroutine work? [closed]

Asked by 6 years ago

'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.

Locked by adark, TheeDeathCaster, and BlueTaslem

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
Answered by
adark 5461 Badge of Merit Moderation Voter Community Moderator
6 years ago

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.

Thanks man! That explains allot! :) TheeDeathCaster 2319 — 6y