How to set Multi-Type array

 

This topic is different from my previous topic...

for example, i want to have a function, which should set a bunch of different variables/values. Then I want to call that function , like this:

xxxx MyArrayContainter;

void OnInit(){
MyArrayContainter = MyFunc();
int a= MyArrayContainter.MyPipSize;
        string b= MyArrayContainter.SosName;
}


xxxx MyFunc(){
MyPipSize = XYZ;
SosName = XYZ;
return {int MyPipSizestring, string SosName};
}

Is anything like this, possible?

 

You can't do this:

return {int MyPipSizestring, string SosName};

However, you can pass variables by reference and modify them directly from within the function.

You also might want to look into the use of structures if you want multi-type arrays.

 
selnomeria: Is anything like this, possible?
You can not return complex types.
//
xxxx MyArrayContainter;

void OnInit(){
MyArrayContainter = MyFunc();
int a= MyArrayContainter.MyPipSize;
        string b= MyArrayContainter.SosName;
}

xxxx MyFunc(){
MyPipSize = XYZ;
SosName = XYZ;
return {int MyPipSizestring, string SosName};
}
struct Values{ int MyPipSize; string SosName; }
Values MyArrayContainter;

void OnInit(){
   MyFunc(MyArrayContainter);
   int    a= MyArrayContainter.MyPipSize;
   string b= MyArrayContainter.SosName;
}

void MyFunc(Values& container){
container.MyPipSize = XYZ;
container.SosName   = XYZ;
return;
}
 
whroeder1:
You can not return complex types.

Wow, thanks!
Reason: