I need to pass an array as a parameter into a function, now before you start telling "but you cant...."
Does Galaxy+ + editor make use of the * reference operator so that if I executed the function by script, I could theoretically pass the pointer leading back to the array into the function.
Also, I need to calculate the length of an array. I know the number of indexes / keys does not change - is there a pre-existing .length() sizeof() , etc... C + + function that I can use without hacking the editor.
1. If you plan to use multiple arrays, create an array of arrays, and pass the index of the array within this meta-array.
2. Save array length in an additional variable after each add/remove element operation. It may be convenient to use structures, to store array and length variable within one variable. Or, if your array's type is int, you can use array[0] to store its length.
Or, if you're 100% sure what value empty element has, you can create your length() function, which would search for index of the last not empty element.
I need to pass an array as a parameter into a function, now before you start telling "but you cant...."
Does Galaxy+ + editor make use of the * reference operator so that if I executed the function by script, I could theoretically pass the pointer leading back to the array into the function.
Also, I need to calculate the length of an array. I know the number of indexes / keys does not change - is there a pre-existing .length() sizeof() , etc... C + + function that I can use without hacking the editor.
I'd suggest 2 things:
1. If you plan to use multiple arrays, create an array of arrays, and pass the index of the array within this meta-array.
2. Save array length in an additional variable after each add/remove element operation. It may be convenient to use structures, to store array and length variable within one variable. Or, if your array's type is int, you can use array[0] to store its length.
Or, if you're 100% sure what value empty element has, you can create your length() function, which would search for index of the last not empty element.
http://www.sc2mapster.com/forums/development/galaxy-scripting-and-trigger-lib/38374-passing-arrays-as-parameters/