Passing Vectors back to UnigineScript


Recommended Posts

Are there any examples of how to return a Unigine::vector<Type> back to UnigineScript? It doesn't appear to work in the way that I would expect.

Unigine::Vector<CustomStruct> &getStruct()
return my_struct;

ExternClass<MyClass> *my_class= MakeExternClass<MyClass>();


MyClass my_class = new MyClass();
CustomStruct structs[] = my_class.getStruct();

Error: Interpreter::parse_expression_array(): "my_class" is not a user array

Link to post

Hi Philip,
Any data type may be returned,except for vector, map ,and enum.
Also, please check the usage of my_array_vector_generate() in this example:,my_array_vector_gener#highlight

How to submit a good bug report
FTP server for test scenes and user uploads:

Link to post
  • 2 weeks later...

So I assume this also applies with structs?


I guess I'll just try to explain what I'm trying to do. So I'm calling an SQLite database in C++ and I'm trying to return the data to UnigineScript, but I'm trying to think of the most practical way to do so.

I'd prefer to perform operations on the data at the UnigineScript level rather than C++.

Link to post
  • 2 weeks later...



Simple way for taking all elements
On С++ side you have CustomStruct array.
Two methods fot it:

getNumCustomStructItems()     // returns number of elements in array
getCustomStructItem(int id)     // returns the specific element

Take elements

MyClass my_class = new MyClass();
CustomStruct structs[0] = ();
forloop(int i = 0; my_class.getNumCustomStructItems()) {

Also, as stated above, please check the usage of my_array_vector_generate() in this example: https://developer.un...gener#highlight

Link to post