title: how to break out of a for loop in lua
body: <p>i have the following code: </p>
  
  <pre><code>  for k, v in pairs(temptable) do
           if string.match(k,'doe') then 
                if v["name"] == var2 then
                       txterr =  "Invalid name for "..k
                       duplicate = true
               end
               if duplicate then
                       break
               end
           end
      end 
  </code></pre>
  
  <p>when duplicate is set to true, i want to exit the for loop all together. right now, it just loops through all the values in the table even if it finds a match. </p>
  
  <p>i tried using the break statement but i think it is breaking out of the "if" statement. </p>
  
  <p>i was thinking about a do while loop i could wrap around the entire for loop but i would still need a way to break out of the for. </p>
  
  <p>thanks.</p>