lua-users home
lua-l archive

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


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.