[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: __pairs metamethod - is it in?
- From: "Steve Donovan" <sjdonova@...>
- Date: Mon, 07 Feb 2005 13:44:10 +0200
>>> 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.