lua-users home
lua-l archive

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


Can someone tell me if this is at least possible?

On Sat, Nov 10, 2012 at 11:05 PM, Giuliano Suminsky <yksnimus@gmail.com> wrote:
Hi
My understanding of what Lunar does is that it allows objects to be created on lua scripts.
How can I modify/use it so that I can give a lua script an existing/living c++ object?

class Agent{

static const char className[];
static Lunar<LuaAIAgent>::RegType methods[];

...exposed methods

void InitLuaScript( const char * szLuaScriptFilename_p ){

 
m_pLua = lua_open(); luaL_openlibs(m_pLua);
Lunar<LuaAIAgent>::Register( m_pLua ); 

// give this object to lua script
}
}

See, instead of giving a type that lua can use to create objects, I want to give an object already created on c++
What I need is methods called from lua able to modify the c++ object.