function values(t)
local i = 0
return function ()
i=i+1
return t[i]
end
end
t={10,20,30}
iter=values(t)
while true do
local val = iter()
if not val then
break
else
print(val)
end
end
for i in values(t) do
print(i)
end
--10
--20
--30
2.