lua-users home
lua-l archive

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


Rather than trying so hard to make it seem like it's actually a new row, I think you're better off to just document for your users that it is the same table re-used: either they can copy it if necessary, or you can offer two versions of the iterator, one which is optimized and one "traditional".

Other than that, you could adapt the idea presented here to get a speed-up of the every-row-is-a-new-table version:
http://lua-users.org/lists/lua-l/2012-12/msg00613.html
But, beware of users who try to iterate over the items of the row using pairs(): you can handle this in 5.2 with __pairs, but in 5.1 it won't be easy.

-- David