✓ Accepted answer
###while CONDITION do runs code whilst the condition specified is true, breaks if the condition becomes false or nil.
while wait() do
end
###That code only runs because the wait function returns the time waited as the first value, and the time since the program started as the second value. It would not run at all if the return value were false or if it didn't return at all. And because that value is truthy in Lua, that code runs indefinitely.
while true do
wait()
end
###You should instead consider using the latter, as it is slightly faster and is more expressive than the former. For these reasons, use while true do.
2 comments
What does truthy and falsey mean (knowing that the opposite of true is false, so, the opposite of truthy is falsey)?
Numbers, strings, tables, objects, and events are truthy in Lua. false and nil are falsey values.