lua-users home
lua-l archive

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


> I like the local copies table approach better than what I'd seen in
> the past. Don't you need, however, to use cnext for the second call
> to next? And presumably you would then also need cforeach.

Yes, I realised later that lazy copied tables can be lazy copied
themselves...  If you change the second next to cnext then cnext should at
least also check if its first argument is a lazy copy...  Then it gets messy
if you mix different kinds of tables, requiring different next/pairs calls
for each...  Could rigorous use of a (fictitious) meta method __pairs help
to solve this?  Then pairs(object) can always be used to iterate over
object.  (I think __pairs reflects "iteration overriding" better than a more
low level __next?)

--
Wim