1 2 3 4 5 6 7 8 9 10 11
function square(state, n) if n < state then n = n + 1 return n, n * n end end for i, n in square,42,0 do print(i, n) end