lua-users home
lua-l archive

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





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].

[1] https://code.google.com/p/oolua/source/browse/branches/dsl/profile/hierarchy.h
[2] https://code.google.com/p/oolua/source/browse/branches/dsl/profile/hierarchy_expose.h
[3] https://code.google.com/p/oolua/source/browse/branches/dsl/profile/hierarchy_expose.cpp
[4] http://lua-users.org/wiki/BindingCodeToLua

--Liam