lua-users home
lua-l archive

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


what about this? make a new function named super:

function M.super(c)
    return c._base
end

then you can call any method like this:

super(self):_init(title)

is this shortcut reasonable?

2013/1/3 steve donovan <steve.j.donovan@gmail.com>:
> On Thu, Jan 3, 2013 at 6:26 AM, Luciano de Souza <luchyanus@gmail.com> wrote:
>> function window:_init(title)
>> control:_init(title)
>> end
>
> That would _almost_ work; it's true that super is the shortcut, but in
> general to call any method of a base class you should say:
>
> control._init(self,title)
>
> That is, look up the method in the base class and call it explicitly.
> Nice if there was a way of creating sugar for this, but I haven't
> found one yet.
>
> steve d.
>



-- 
regards,
Xavier Wang.