Multidimensional input to a function

9.59K viewsScripting


I am trying to define a simple function using scripting:
* Inputs: a list of elements, for instance item:id[first]..item:id[last]
* Output: any function of the whole elements (sum for instance)

How should I declare the input in the script of the function?

Under Java, I would have declared as input of my method “test” an array of doubles (“input”) containing the values “item:id[first]..item:id[last]” and written:

double test( double[] input ){
int numberItems = input.length;
double result = 0;
for( int i=0 ; i<numberItems ; i++){
result = result + input[i];
return result;

Thank you.




Many thanks for your very, very helpful explanation. This opens many new opportunities when developing user defined functions.


You are viewing 1 out of 16 answers, click here to view all answers.