lua-users home
lua-l archive

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

Joshua Jensen wrote:
> > Just for completion, the Sol version ;-)  (and some comments)
> >
> > methodTable2 = methodTable:class {  -- inherit methods from
> [...]
> This is a great approach.  Just cross your fingers that nobody ever
> removes the function class() from the method table!  :)

Please note that it's :class, a method from Super!

> Or possibly just:
> methods(myTable).func2()

I consider methods() a low level function that shouldn't be used
for regular programming tasks.

> myTable->methodTableFuncWithSelf()   -- Implicit self passed through to
> a method table function.
>       Which is the same as:
>            methods(myTable).methodTableFuncWithSelf(methods(myTable))
> and
>            methods(myTable):methodTableFuncWithSelf()

Uh, no ;-)   methods(myTable).methodTableFuncWithSelf(myTable)

Using shorter names:
  a->x()   would be   methods(a).x(a)

[But using the colon for this looks much much better! SCNR ;-)]

Ciao, ET.