> > function square(state,n) if n<state then n=n+1 return n,n*n end end > > for i,n in square,5,0 do print(i,n) end > > I thought I understood how "for" worked [...] I don't see the general > rule to which this conforms. See http://www.lua.org/manual/5.0/manual.html#2.4.5 (the second part).