lua-users home
lua-l archive

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


No, sorry. You're right. I'm using LuaBind. I'm amazed you figured that out from my post. Here's my most recent attempt:

void Person::Setup( void )
{
const char* className = m_LuaClassName;//"Soldier";
// trying to make a function on the fly to give me an empty object of specified Lua type
char functionCode[ 384 ];
strcpy( functionCode, "function GetLuaVersion()\n" );

// assemble the line "return Class()"
char returnClassLine[ 256 ];
strcpy( returnClassLine, "return " );
strcat( returnClassLine, className );
strcat( returnClassLine, "()\n" );
strcat( functionCode, returnClassLine );
strcat( functionCode, "end\n" );

luaL_dostring(
L,
functionCode
);

//get the new 'Soldier' object
m_LuaClassObject = luabind::call_function<luabind::object>( GetLuaHandle()->GetLua(), "GetLuaVersion" );

//several attempts at moving the data from this (Person) into the Lua Soldier on the following lines
luabind::call_member<void>( m_LuaClassObject, "Setup" );
}