lua-users home
lua-l archive

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



On 5-Feb-05, at 12:00 PM, PA wrote:
Assuming the following invocation:

anObject.doIt( true )

And the following __index function:

__index = function( aTable, aKey )
    return this.forwardInvocation( aKey, ????? )
end

What's "this" ?

anyway, I think what you want to do is:

__index =
 function(this, aKey)
   return
     function(...)
       return this.forwardInvocation(unpack(arg))
     end
 end

or something along those lines.

In other words, the __index function is simply returning the
value corresponding to anObject.doit, which value should in
this case be a function. That function will be called in
due course.