大佬教程收集整理的这篇文章主要介绍了一个可以返回多值的迭代器,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
function list_iter_time(t,timE) local index = 0 local size = #t return function() local result = {} --- bug local loop = (size - indeX) % time and time local loop = size - index >= time and time or size % time if index + loop <= size then for i = 0,loop do table.insert(result,t[index + i + 1]) end index = index + loop end return unpack(result) end end --sample for val1,val2,val3 in list_iter_time({1,2,3,4,5,6,7,8},3) do print(val1,val3) end
以上是大佬教程为你收集整理的一个可以返回多值的迭代器全部内容,希望文章能够帮你解决一个可以返回多值的迭代器所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。