Added support for passing parameters in and out of scripts.

Implemented support for osg::ValueObject in LuaScriptEngine.
This commit is contained in:
Robert Osfield
2013-09-24 15:17:42 +00:00
parent 796314c339
commit 6d8f40d13a
10 changed files with 397 additions and 24 deletions

View File

@@ -15,6 +15,7 @@
#define LUASCRIPTENGINE_H
#include <osg/ScriptEngine>
#include <osgDB/PropertyInterface>
extern "C" {
#include <lua.h>
@@ -36,7 +37,7 @@ class LuaScriptEngine : public osg::ScriptEngine
virtual const std::string& getLanguage() const { return _language; }
/** run a Script.*/
virtual void run(osg::Script* script);
virtual bool run(osg::Script* script, const std::string& entryPoint, Parameters& inputParameters, Parameters& outputParameters);
/** get the lua_State object.*/
lua_State* getLuaState() { return _lua; }
@@ -47,10 +48,20 @@ class LuaScriptEngine : public osg::ScriptEngine
virtual ~LuaScriptEngine();
bool loadScript(osg::Script* script);
bool pushParameter(osg::Object* object);
bool popParameter(osg::Object* object);
lua_State* _lua;
typedef std::set< osg::ref_ptr<osg::Script> > ScriptSet;
ScriptSet _loadedScripts;
osgDB::PropertyInterface _pi;
};
}
#endif
#endif