lua-users home
lua-l archive

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


Thanks all, I shall digest and respond when I've pulled together everything everyone's said in my head.

Wonderful to get such a nice response from a mailing list,


Rob


From: Arvid Norberg <c99ang@cs.umu.se>
Reply-To: Lua list <lua@bazar2.conectiva.com.br>
To: Lua list <lua@bazar2.conectiva.com.br>
Subject: Re: Object oriented access of c++ objects in lua
Date: Tue, 10 Aug 2004 21:17:21 +0200

http://luabind.sf.net may also interest you.
It does what you have described.

Rob Sadedin wrote:
Hey all, some advice, if you don't mind:

I'm accessing a number of c++ objects by create a lua user data that
contains a pointer to the object, and sets a meta table that fires on
indexing that points to functions that link to the appropriate c++ methods
for the given object.

lobj = create_my_cpp_obj_and_return_lua_data()
lobj::callsomecppmethod()


Is this a sensible method, and if not, what would be better?

Secondly, I'd like the users to be able to add lua data to the c++ objects.

That is, say something like:

-- Set a variable
lobj.x = 6


waaaaay later in the code:

lobj = get_that_object_I_created_before_and_stored_in_a_cpp_list_somewhere()

print(lobj.x)

* this should output 6 ... well, I'd like it to :)

I hope this makes sense, thanks guys,


Rob



--
Arvid Norberg

_________________________________________________________________
Find love today with ninemsn personals. Click here: http://ninemsn.match.com?referrer=hotmailtagline