lua-users home
lua-l archive

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


The table lookup happens first, so the __index metamethod needs to return a function. That function will then be called with the "original" (and only) arguments.


On 5-Feb-05, at 11:25 AM, PA wrote:

Hello,

I would like to be able to "forward invocations" when an object doesn't implement a given method.

My objects are defined as tables of functions, which are usually invoked like this:

anObject.doIt( true )

'anObject' being a table. 'doIt' a function. And 'true' a parameter.

If the 'anObject' table doesn't have a 'doIt' key, I can most likely catch this with metatable __index... but... how do I get the original parameters so I can build an alternative invocation to dispatch somewhere else?

TIA!

Cheers

--
PA, Onnay Equitursay
http://alt.textdrive.com/