[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Why does this exit the function early?
- From: Mike Crowe <drmikecrowe@...>
- Date: Thu, 18 Jun 2009 13:10:09 -0400
You were using "break" as if it were "continue", which lua doesn't have.
break terminates the while loop.
Paul Butler wrote:
Why does the "break" end the function?
I was expecting it to count to 10 and just skip over 5.
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?")