lua-users home
lua-l archive

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


On Thu, Jan 27, 2011 at 08:42:32AM +0200, David Manura wrote:
> 
> The Reference Manual specifies the mechanics of `__ipairs` [1] but not
> its intended purpose.  

I use it exclusively as a hack that allows `for` loops to work with 
proxy tables too.  Thus:

    __pairs = function(t) return pairs(t[index]) end;
    __ipairs = function(t) return ipairs(t[index]) end;

Dirk