Jump to content

Search the Community

Showing results for tags 'array passing'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to UNIGINE Forums
    • News & Announcements
    • Getting started
  • Development
    • Content Creation
    • World Design
    • Rendering
    • Animation
    • Physics, Navigation and Path Finding
    • UI Systems
    • Sound & Video
    • Editor
    • C++ Programming
    • C# Programming
    • Networking
    • Sim IG (Image Generator)
    • VR Discussions
    • General
  • Improving UNIGINE
    • Documentation
    • Feedback for UNIGINE team
    • Bug Reports
    • Unigine SDK Beta feedback
  • Community
    • Add-on Store (https://store.unigine.com/)
    • Showcase
    • Collaboration
    • Tools, Plugins, Materials & Tutorials
    • General Discussions
  • Legacy
    • UnigineScript

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 1 result

  1. I can pass an array to a global C++ function, from the example given in the topic: int arrayOfInts[] = ( 0, 1 ); int i = 0; my_array_vector_set( arrayOfInts, i, string(i) ); no problem. However, doing essentially the same call, but to a method of a C++ class gives an error: ArrayPassingClass passingTest = new ArrayPassingClass(); passingTest.my_array_vector_set2( arrayOfInts, i, string(i) ); gives "Interpreter::parse_expression(): arrays can't be used in expressions" In C++: class ArrayPassingClass { public: // 2.1. Declare a class constructor that will be exported into Unigine script. ArrayPassingClass() { } ~ArrayPassingClass() { } void my_array_vector_set2(const Variable &id,int index,const Variable &v) { ArrayVector vector = ArrayVector::get( Interpreter::get(), id); vector.set(index,v); } }; void my_array_vector_set(const Variable &id,int index,const Variable &v) { ArrayVector vector = ArrayVector::get( Interpreter::get(), id); vector.set(index,v); } ... ExternClass<ArrayPassingClass> *my_arrayPassingClass = MakeExternClass<ArrayPassingClass>(); my_arrayPassingClass->addConstructor(); my_arrayPassingClass->addFunction( "my_array_vector_set2", &ArrayPassingClass::my_array_vector_set2 ); Interpreter::addExternClass("ArrayPassingClass", my_arrayPassingClass ); Interpreter::addExternFunction("my_array_vector_set",MakeExternFunction(&my_array_vector_set,"[]")); Do things need to be done differently when calling a member function? or, is this a bug? If so, does it have a work-around?
×
×
  • Create New...