lua-users home
lua-l archive

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


>>> asko.kauppi@sci.fi 02/07/05 12:32PM >>>

>Why so complicated?
>    pairs = function( t )
>         local mt = getmetatable( t )
>         return ( ( mt and mt.__pairs ) or raw_pairs )( t )
>     end

It would be very cool if 'for i,v in t do...'
would use the global pairs() function;  that would
(a) make quite explicit what the for-loop means
if t isn't an iterator function and (b) make interesting
overloading possible, such as above.

steve d.