现在位置 >首页 > ipairs
3℃
2012年01月30日 Lua ⁄ 被围观 27,837 次+
lua 中pairs 和 ipairs的区别 ipairs (t) Returns three values: an iterator function, the table t, and 0, so that the construction for i,v in ipairs(t) do body end will iterate over the pairs (1,t[1]), (2,t[2]), ···, up to the first integer key absent from the table. pairs (t) Returns three values: the next function, the table t, and nil, so that the construction for k,v in pairs(t) do body end will iterate over all key–value pairs of table t. See function next for the caveat...
阅读全文