lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

You were using "break" as if it were "continue", which lua doesn't have.

break terminates the while loop.

Paul Butler wrote:
Newbie question.....

Why does the "break" end the function?
I was expecting it to count to 10 and just skip over 5.

function doThis()
  local count = 0
  while true do
    count = count + 1
	if count == 5 then break end
	if count == 10 then return end
  print("why are we here?")