lua-users home
lua-l archive

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



One solution would be to copy the methods from Control to Label.


De: liam mail <liam.list@googlemail.com>
Para: Jose Marin <jose_marin2@yahoo.com.br>; Lua mailing list <lua-l@lists.lua.org>
Enviadas: Sexta-feira, 14 de Junho de 2013 10:35
Assunto: Re: Inheritance with Lunar




On 14 June 2013 13:26, Jose Marin <jose_marin2@yahoo.com.br> wrote:
Hi,

I´ve looking for this subject in the internet, did some tests but not found an answer.

It´s possible for a class declared in Lunar to inherit methods from another class?

Example (pseudo code):

class Control
{
public:

    void setPosition(int x, int y);
};

class Label: public Control
{
public:

    void setText(const char* text);
};


Label is derived from Control, so it should access the method setPosition from Control class.


Thanks

Jose


Not using Lunar, but given the class hierarchy [1] then [2] and [3] are how Luabind, LuaBridge, OOLua and SLB3 bind such classes and they all support your request. If they are not to your liking there are other libraries which bind C++ and Lua listed on the wiki[4].


--Liam