[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Newbie questions regarding luasocket, tables
- From: Sam Roberts <sroberts@...>
- Date: Tue, 8 May 2007 11:12:15 -0700
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.