lua-users home
lua-l archive

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


Some of the info on the wiki will probably be helpful:

http://lua-users.org/wiki/

At the bottom of the page click on "Find Page" and do a full search for
"cpp".  It should turn up several pages with info on binding c++ objects
to lua.

-Kevin

> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br 
> [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Rob Sadedin
> Sent: Saturday, February 07, 2004 4:24 PM
> To: Lua list
> Subject: Object based scripting integration
> 
> 
> Hey guys,
> 
> I'm sure, in one way or another, this has been asked a 
> million times, and if it's too annoying or boring, don't 
> bother answering :).
> 
> Basically, I can setup simple scripting integration with my 
> c++ code calling static methods very easily (kudos to Lua).
> 
> What I'd like to be able to do, is run a game scripting
> system where all the code is written in lua, but all the 
> object construction is handled in my c++ code.
> 
> ie, you call call something like:
> obj = createMyObject()
> This returns, I guess, a table with functions and variables 
> set from the c++ object that the call created.
> 
> Can I somehow magically make it so that a call to 
> obj:getSomeResult(), from Lua, will lookup the c++ object 
> that has been set in the table and call the function it's 
> linked to?  Can I set this relationship up when 
> createMyObject is called simply, without too much overhead?
> 
> I guess I'm asking for a mapping between an object (not a class, an
> instance) created in c++, and LUA, and then being able to 
> manipulate that object through LUA and also preferably 
> through c++, all values and functions being taken into account.
>