I have a loop in lua and when a certain thing happens I want it to start the loop over. However when I do return it just ends the loop.
wrong = false
while true do
    if wrong then
      return
    end
    print 'Not wrong'
end
I have a loop in lua and when a certain thing happens I want it to start the loop over. However when I do return it just ends the loop.
wrong = false
while true do
    if wrong then
      return
    end
    print 'Not wrong'
end
 
    
    First of all return does not terminate your loop, it terminates the entire function / script. Be aware of that! To terminate a loop use break. You are looking for an equivalent to "continue" in other languages.
There is no such thing in Lua. You could fiddle something together using goto statements which are available in newer Lua versions but in general you could simply rewrite your code:
while true do
  if not wrong then
    print("not wrong")
  end
end
 
    
    Return terminates a function and returns a value. I believe you want to break out of a loop
