title: Lua Iterators: Interchanging argument's position results in infinite loop
body: <p>If i am interchanging the argument position in <code>function iter2(max,key)</code> to <code>iter2(key,max)</code> and invoking the same as <code>iter,1,8</code> it is resulting in an infinite loop.</p>
  
  <pre><code>function iter2(max,key)
     if key == nil then
        return 2 , "value:" .. 2
     end
     if key &gt;= max then
        return nil
     else 
        return key+2, "value:" .. key+2
     end
  
  end
  
  for k,v in iter2,8,1 do
     print(k,v)
  end
  </code></pre>
  
  <p>What is the reason behind this behavior?</p>