lua-users home
lua-l archive

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


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