示例,泛型和迭代器 2015/12/14 14805 function values( t ) -- body local i = 0 return function ( ... ) i = i+1 return t[i] end end t = {2,432,56,54,23} for element in values(t) do print(element) end