As I understand it, doing
while true do
--code
wait()
end
is considered better than doing
while wait() do
--code
end
Why is this?
As I understand it, doing
while true do
--code
wait()
end
is considered better than doing
while wait() do
--code
end
Why is this?
It isn't bad, people just say it's bad practice. wait() is a ROBLOX Lua function, the reason it works is because wait() returns values making it true. It's bad practice because if you were to move on from ROBLOX's engine, your loops wouldn't work because wait() wouldn't return anything.
I got this information from this video by ScriptGuider:
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
some how, some way the code structure of while wait() gives more strain to the game compared to otherwise.
to understand this ull most probably have to look behind the way roblox is designed
or who knows its probably just some conspiracy that roblox spread im not a professional
its just a bad habit to use while wait() do cuz it only runs fine on roblox.