示例,泛型和迭代器

2019PHP高薪工程师学习路线图....>>>

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