Hello, I’m trying to make a coroutine that runs on an endless cycle waiting for 1 second after each cycle but the coroutine.wait() function appears to be yielding instead of waiting.
Here’s what I’m doing
local TestThread = coroutine.create( function() while ( true ) do print('test') coroutine.wait( 1 ) end end ) coroutine.resume(TestThread)
I create a coroutine that is a function with a while true do statement, this should make the coroutine endlessly repeat.
In order to not lock up my game and/or get a stack overflow I am calling coroutine.wait()
“test” prints once into the console and never again, when I call coroutine.resume(TestThread) it will print “test” into the console once more.
If I print the status of the coroutine it is suspended which is supposed to only be the case after a yield is called.
It was to my understanding that this code should endlessly repeat “test” into the console once every 1 second.
What am I doing wrong here?