1

次のようなコードで、lua スクリプト言語をシリアライゼーション ライブラリと統合したいと考えています。

void cSerializableLua::ThisToLua( lua_State* l, bool classDeclaration )
{
    if( classDeclaration )
    {
        getGlobalNamespace( l )
        .beginNamespace( "CLASS" )
            .beginClass<Property>( "Property" )
                .addProperty( "Number",   &Property::GetNumber, &Property::SetNumber )
                .addProperty( "String",   &Property::GetString, &Property::SetString )
                .addProperty( "Real"  ,   &Property::GetReal,   &Property::SetReal   )
            .endClass()
        .endNamespace();
    }

    for( iterator it = this->begin(); it != this->end(); ++it )
    {
        Property* iser = *it;

        std::string namespaceLUAName = iser->Path(false);
        std::string objectLUAName    = iser->Name();

        getGlobalNamespace( l )
        .beginNamespace( namespaceLUAName.c_str() )
            .addVariable( objectLUAName.c_str() , iser)
        .endNamespace();
    }

    for( cChildList::iterator it = this->ChildList()->begin(); it != this->ChildList()->end(); ++it )
    {
        cSerializableLua* iser = *it;
        if(iser) { iser->ThisToLua( l, false ); }
    }
}

残念ながらLuaBridgeはほぼ完璧に機能し、「クラスプロパティ」オブジェクトのコピーを作成しているため、スクリプトで行うすべての変更は次のとおりです。

VSPThread.STADDR.String = "http://87.239.46.3/mjpg/video.mjpg"
VSPThread.WIDTH.Number = 640
VSPThread.HEIGHT.Number = 480
VSPThread.ENABLE.Number = 1

私の C++ ライフタイム オブジェクトを変更しないでください。

私の質問は、変更されたデータを自分の C++ オブジェクトにコピーするように LuaBridge に強制するにはどうすればよいですか?

4

0 に答える 0