function fooIter(n,x)
local i = string.len(x)
if i < 10 then
if 0 == i%2 then
return x,true
else
return x,false
end
end
return nil
end
function foo(s)
return fooIter,nil,s
end
local N = 0
for p,s in foo("d") do
N = N + 1
print(N, p, s)
if( s ) then
p = p .. "o"
else
p = p .. "x"
end
if N > 15 then break end
end