有趣的事

for i in print, "123" , "368" do end 输入:123 368 function iter (a, i) i = i + 1 local v = a[i] if v then return i, v end end a = {"one", "two", "three"} for i, v in iter, a, 0 do print(i, v) end 输出:1 one 2 two 3 three 注:in会执行放入的函数并将后续变量作为参数传入函数中

posted on 2014-11-26 21:30  AD_1990  阅读(76)  评论(0)    收藏  举报

导航