function list_iter (t)
local i = 1
local n = table.getn(t)
local f
local fs
return function ()
if i <= n then
if type(t[i])=="table" then
if f==nil then f=list_iter(t[i]) end
fs=f()
if fs then return fs else i=i+1 f=nil end
else i = i + 1 return t[i-1] end
end
end
end
t = {10, 20, 30,{50,60,70,{100,200,300}}}
for element in list_iter(t) do
sysLog(element)
end
--迭代器通过判断自动调用自我返回子table的闭包