Dude moving from Roblox here, is there a similar function to wait()? Never coded in actual Lua, only the Roblox version of Lua, LuaU.
Also, probably a dumb question, but how do I use a while true loop without it freezing the game? You could just put a wait() in the while loop in Roblox to stop it from crashing, but is there a way to do it here?
I had a couple of strange issues with the built-in coroutines mentioned in the above post. So to add to the available options, I’ve not had any issues using DefUniCo.
self.start_coroutine(function(self)
-- wait one second
wait_seconds(1)
print("One second has passed.")
end)
A reminder that the Lua runtime is single threaded.
A coroutine aren’t run on a separate thread, so when you wait X seconds, you’re stalling the entire engine.