Simple question: can a function return an array?
And can I collect data from the function like
value.x = MyFunction(inputparamter).xcoordinate;
value.y = MyFunction(inputparamter).ycoordinate;
value.speed = MyFunction(inputparamter).speed;
or can I even state:
value= MyFunction(inputparameter);
Cheers,
Martijn
You seem to want to use classes in that first one.
QuoteSimple question: can a function return an array?
Yes, a function can return an array. I don't know if AGS allows this or not...why don't you try it and tell us
And can I collect data from the function like
Quote
value.x = MyFunction(inputparamter).xcoordinate;
value.y = MyFunction(inputparamter).ycoordinate;
value.speed = MyFunction(inputparamter).speed;
As Eric pointed out, this is the notation you would use to call a function that is within a class.
int x_value = MyClass.GetXCoordFunction(int parameter);
Quotevalue= MyFunction(inputparameter);
This is the regular way of using a function.
am not sure about the classes. I use the struct command to set up value.x, value.y etc.
cheers,
martijn
Functions cannot return structs or arrays - they can only return primitive types.
The workaround is to create a global variable which the function updates.