lua-users home
lua-l archive

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


John Hind wrote:
Ugg! Not a good choice, in my opinion! There is a "right choice" of iterator
for different types of object and it should be contextually selected not
having to remember whether to use pairs or ipairs.
Not true.
I often have multi-use tables, such that t[id] = t[n] = object.
I can then lookup objects by id, or iterate them with ipairs.
In this case, how would your code 'contextually select' the iterator ?

Apart from this consideration of principle, it is using two metamethods to
do a half-assed job that could be properly done with just one!
Is the solution half-assed, or your understanding of the problem ?