lua-users home
lua-l archive

Re: ipairs in Lua 5.3.0-alpha

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Aug 14, 2014, at 8:26 PM, Jan Behrens <jbe-lua-l@public-software-group.org> wrote:


for n = 1, 10000 do
for i, v in some_func, {t, #t}, 0 do
-- do something with i and v here
end
end
========================================

This construct will create 10000 tables (which need to be collected by
the garbage collector later).

So create the table outside the outer loop and re-initialize it for each pass in the inner loop.

—Tim


AltStyle によって変換されたページ (->オリジナル) /