lua-users home
lua-l archive

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


On Wed, 2009-09-30 at 23:34 +0200, Michal Kolodziejczyk wrote:
> Or you could keep a counter within the table (so you will not iterate
> the table at all). Here is an example implementation (you can overide
> removeOne() to what you need):
> 
> MT={
>   add=function(self, key, value)

Wow... Never seen metatables used like that. Had to look it twice to get
why it works :)

Is there a way for keeping _n and _limit out of the table? With some
upvalue magic or something? Otherwise you have to explicitly skip them
while iterating (as the RemoveOne as is does not :) )

Jorge