lua-users home
lua-l archive

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


2013/2/25 Kevin Martin <kev82@khn.org.uk>:
> Can you write some Lua code as an example of what you're trying to achieve? I don't understand.

Imagine that (Prototype in C++):

// header.h

class base {
public:
    base (....);
    ~base ();

    void someFunction (...);
    void SetterFunction (...);
    void GetterFunction ();

    int a, b, c;
};

class sub : base {
public:
    sub (...) : base (...) {
        //Some sub setters here !
    }
    ~sub (...) {
        // ....
    }
    void printString (...);
    void someGetter ();
    void someSetter (...);

     int d, e, f;
};

Now , i want to be able to use it in LUA like this :

-- test.lua

a = NewBase (...)
a:someFunction (...)
a:SetterFunction (...)

print ( a:GetterFunction () ) --Thats all i want lua to do with the
base class ...

b = NewSub (...)
b:someFunction (...)
b:SetterFunction (...)

print ( b:GetterFunction () )  --Now , that functions should be
available for b object BUT i want to be able to write :

b:printString (...)
b:someSetter (...)
b:someGetter (...) -- also !!!

If someone can provide a sample code for this , it WILL be appreciated
!!! Sorry for the newbie questions !
Again thanks for answering !!!