eugene.litvinov Posted January 21, 2011 Share Posted January 21, 2011 It could be great, if script allow next construction: private: Editor editor; public: Editor getEditor() { return editor; } . . . getEditor().showKeyLine(); It could be useful while using get/set methods Now it can be do only like: Editor editor = getEditor(); editor.showKeyLine(); Link to comment
eugene.litvinov Posted April 15, 2011 Author Share Posted April 15, 2011 In Unigine manual says: Accessing Elements of the Function Source code (UnigineScript) vec3 foo() { return vec3(1.0,2.0,3.0); } printf("%f %f\n",foo().x,foo()[0]); // the result is: 1 1 printf("%f %f\n",translate(1.0,2.0,3.0).m23,translate(1.0,2.0,3.0)[14]); // the result is: 3 3 Why this feature not work with this: PlayerActor foo() { return new PlayerActor(); } log.message("test = " + foo().getName()); or with user's classes? What Am I doing wrong? Link to comment
manguste Posted April 19, 2011 Share Posted April 19, 2011 Why this feature not work with this: PlayerActor foo() { return new PlayerActor(); } log.message("test = " + foo().getName()); or with user's classes? What Am I doing wrong? It is because the returned value is a class. This trick works only with simple types. As for classes, you need to cast them to their own type: class Bar { string toString() { return "bar"; } }; Bar bar() { return new Bar() }; printf("%s\n",Bar(bar()).toString()); Link to comment
eugene.litvinov Posted April 19, 2011 Author Share Posted April 19, 2011 I see, but cast all times seems redundant and not user friendly ( Link to comment
Recommended Posts