Hi, Rober 

I have not added any object to outputParameters, and after script run I have 
object in output parameters. So I understand it outputParameters.

But I still have problem with value object as Vec3f or similar. 
here is C++ code .

int main( int argc, char **argv )
{
        
        osg::ArgumentParser arguments(&argc,argv);
        osgDB::getDataFilePathList().push_back( "D:/zbcmy/osg33/data/" );

        osg::ref_ptr<osg::Script> script = 
osgDB::readScriptFile("D:/zbcmy/vosg2/Debug/script/test.lua");
        if (script.valid())
        {
                osg::Parameters inputParameters;
                osg::Parameters outputParameters;
                inputParameters.push_back(new osg::MatrixTransform);
                inputParameters.push_back(new 
osg::Vec3fValueObject("Vec3f",osg::Vec3f()));
                osg::ref_ptr<osg::ScriptEngine> luaScriptEngine = 
osgDB::readFile<osg::ScriptEngine>("ScriptEngine.lua");

                if (luaScriptEngine->run(script.get(),"test", inputParameters, 
outputParameters))
                        OSG_NOTICE<<"Successfully ran script : return value = ";
                else
                        OSG_NOTICE<<"script run failed"<<std::endl;
        }
        _getch();
}

and lua code 

function test(a,k)
        a.Name = "Pito";
        a.Matrix = new ("osg::Matrixf()");
        e = new ("osg::Vec3f");
        --a.Matrix.Trans()
        return a;
end

output 
Lua error : attempt to call a table value
Function doesn't accept osg value object ? Something is wrong but I don't know 
what is wrong. 

When I comment out line with Vec3fValueObject I get output 

ClassInterface::createObject(osg::Matrixf()), No object wrapper avaiable.
Failed to create object osg::Matrixf()
LuaScriptEngine::setPropertyFromStack(0060FF80, Matrix) property of type = 
MATRIX not implemented
ClassInterface::createObject(osg::Vec3f), No object wrapper avaiable.
Failed to create object osg::Vec3f

I think that creation Matrix or Vec3f in Lua code is wrong , but I don't know 
how to do this. 

Many thanks that you spent your expensive time with my not clever posts but I 
don't see any way for learn lua scripting in OSG.

Cheers,
Martin

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=62743#62743





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to