[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: index tag method
- From: Steve Dekorte <steve@...>
- Date: Mon, 12 Feb 2001 10:42:11 -0800
John Belmonte wrote:
> The index tag method is a sub-case of gettable and can be removed, reducing
> the complexity of tag methods and slimming down luaV_gettable in the virtual
> machine. If the user wants to treat a previously nil (or any other value
> or type for that matter) index as a special case they can do it with
> gettable, so why go as far as having this in the VM which slows down all
> table reads?
I think the most common use of a hook on table access is to implement
inheritance. In that case, you only care about look ups on missing table
elements. Having to handle all look ups just to catch the nils would be
very slow, particularly if your hook is implemented in Lua.