lua-users home
lua-l archive

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


> 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)?