lua-users home
lua-l archive

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

>That is, I'm sorry, but I fail to see why one might need a __removeindex

That's because you didn't try removing an index :)

> require'hash'
> h=newhash()
> h.k1=10
> h.k2=20
> = getmetatable(h).__len(h)
> h.k1=nil
> = getmetatable(h).__len(h)

Oops. It only has one element after I removed k1

(sorry for the getmetatable stuff, this is 5.0 so no #h - this is
equivalent, though)