lua-users home
lua-l archive

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


On Tue, May 08, 2007 at 06:40:42PM +0100, Paul Hudson wrote:
> > Using metatables, I'd imagine this would be easy to implement. The __newindex method is provided to catch new entries to the table, which is 
> > where you count new entries. I'd go a step further and memoize a function that returned these counts, and use the table itself as a key in the 
> > memoization. 
> 
> I think you'd run into the problem that there isn't any metamethod
> called when a table entry is set to nil (aka deleted)?

__newindex() is called with a value of nil, in this case.

Sam