[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Lua oop?
- From: "Kevin Baca" <lualist@...>
- Date: Sat, 26 Jul 2003 19:38:26 -0700
Title: Message
Check
this out:
And
especially these:
-----Original Message-----
From:
lua-bounces@bazar2.conectiva.com.br [mailto:lua-bounces@bazar2.conectiva.com.br]
On Behalf Of Ando Sonenblick
Sent: Saturday, July 26, 2003 1:38
PM
To: lua@bazar2.conectiva.com.br
Subject: Lua
oop?
Gang,
I’m developing an animation engine that will have
user level scripting implemented in lua (I’ll be embedding lua into my c++
app). I’m perusing tons of websites, reading up on the lua.org
documentation and so on to learn lua, how to embed it, extend it, etc..
One thing I am not finding any real info on is any object
oriented programming aspects of lua. As of now, I’m not needing
inheritance, encapsulation, etc. Well, instead of saying what I don’t
need, why don’t I simply say what I do need, and hopefully someone can tell me
if it’ll be possible:
In my C++ code I have, say, a widget
class:
class Widget
{
long
aValue;
public:
void
SetValue(long v) { aValue = v;
};
long GetValue(void) { return
aValue; };
};
Now, I want to make this object available for
manipulation in a lua script. So say the script is something like
this:
function main(widget)
-- I need
first to be able to pass things to a function (but I believe that the stack
calls allow this easily
enuf)
widget:SetValue(10);
-- important to get the “:”
operator to bind an object reference to a
method
print(widget:GetValue()); --
displays 10
end
So, that’s my initial prime objective: having
lua access my C/C++ objects in a clean OOP syntactic way.
I’ve seen some things like tolua and other C++ wrappers, but
I’m looking for info on how they do what they do, not just getting a tool to
do it.
So, can anyone give me some pointers here?
Thanks
much,
Ando
-----------------
SpriTec
Software
www.spritec.com