lua-users home
lua-l archive

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


Roberto Ierusalimschy wrote:
> 
> > >       metatable(A, {index=B})
> >
> > Hmm... If you do this, then _please_ honour the function (call) tag
> > method of B and only do this redirection if it's not set!
> >
> > "Calling" tables allows much more things then this simple redirection.
> 
> But this simple redirection is *much* faster than a regular tag method.

Sure.  That's why I said you should only _honour_ the function tag method.
If there's no function method on B you may do this "simple inheritance".

You want a uniform behaviour: when someone calls an object and it's not a
function then its call tag method is executed instead.  Clean and simple.
Don't start to make exceptions a la: we ignore the call tag method on
objects stored in some special tag methods...

Ciao, ET.