From 8ad0ab1f6b259223e615b15d604e03e7a64b5518 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 7 Feb 2014 16:06:57 +0000 Subject: [PATCH] Fixed handling of returns when invoking a script, removed some debug messages, added a warning message when detecting erronous types. Added FocusBehaviour enum to osgGA::Widget serialization --- src/osgPlugins/lua/LuaScriptEngine.cpp | 22 ++++++++++---------- src/osgPlugins/lua/ReaderWriterLua.cpp | 3 --- src/osgWrappers/serializers/osgGA/Widget.cpp | 7 +++++++ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/osgPlugins/lua/LuaScriptEngine.cpp b/src/osgPlugins/lua/LuaScriptEngine.cpp index 9826f4fbc..c81b64d99 100644 --- a/src/osgPlugins/lua/LuaScriptEngine.cpp +++ b/src/osgPlugins/lua/LuaScriptEngine.cpp @@ -52,7 +52,6 @@ public: { outputParameters.insert(outputParameters.begin(), _lse->popParameterObject()); } - return true; } @@ -133,18 +132,18 @@ static int callClassMethod(lua_State* _lua) const LuaScriptEngine* lse = reinterpret_cast(lua_topointer(_lua, lua_upvalueindex(1))); std::string methodName = lua_tostring(_lua, lua_upvalueindex(2)); int n = lua_gettop(_lua); /* number of arguments */ - OSG_NOTICE<<"callClassMethod(), n = "<=1 && lua_type(_lua, 1)==LUA_TTABLE) { osg::Object* object = lse->getObjectFromTable(1); const std::string compoundClassName = lse->getObjectCompoundClassName(1); // object->getCompoundClassName(); - OSG_NOTICE<<"callClassMethod() on "<className()<<" method name "<className()<<" method name "<popParameterObject()); } @@ -154,12 +153,17 @@ static int callClassMethod(lua_State* _lua) itr != outputParameters.end(); ++itr) { - OSG_NOTICE<<" pushing return "<<(*itr)->className()<className()<pushParameter(itr->get()); } return outputParameters.size(); } } + else + { + OSG_NOTICE<<"Warning: lua method called without passing object, use object::method() convention."<(this)); lua_pushstring(_lua, propertyName.c_str()); lua_pushcclosure(_lua, callClassMethod, 2); @@ -728,7 +732,6 @@ int LuaScriptEngine::setPropertyFromStack(osg::Object* object, const std::string { int ref = luaL_ref(_lua, LUA_REGISTRYINDEX); - OSG_NOTICE<<"LuaScriptEngine::setPropertyFromStack("< libraryName="<(objects[0].get()); - OSG_NOTICE<<"readObject form script, have one object "<className()<<" "<