When I asked how to make the game sleep for x miliseconds I was told that there was no concept of waiting so I then set out on a journey to discover a sleep function, I came out with this.
function sleep(n) timer.performWithDelay(n,function() coroutine.resume(co) end) coroutine.yield() return true end function main() local i = 0 while sleep(1000) do i = i + 1 print(i) end end co = coroutine.create(main) coroutine.resume( co )
I don’t see a downside to using this. before I was using a recursive function in a perform with delay to achieve a delay effect.