I know that I can create an array of arrays because of Wave's fantastic tutorial, thus:
and that I would access the relevant sub-array as:
Ok, I would like to use this facility to hold integer path positions, and so the array will be created/re-initialised in my level_init() routine. I would normally re-dimension an array using:
so my questions are as follows:
1. if I re-dimension the big array holding all the sub arrays will it clear out/free up/garbage collect all previously dimensioned sub-arrays and any data that they hold (which is what I want to happen)? If so, what is the syntax for doing that?
2. Can I declare the big holding array without knowing the size of the sub-arrays, and then re-dimension the sub-arrays as I need them? Again, what would be the required syntax?
To make it clearer, the workflow would be something like this:
I hope that this makes sense! :-)
MyArray[][] = [ [1,2,3,4],[5,6,7],[8,9,0] ]
and that I would access the relevant sub-array as:
MyArray[ArrayNumber][Position]
Ok, I would like to use this facility to hold integer path positions, and so the array will be created/re-initialised in my level_init() routine. I would normally re-dimension an array using:
MyArray = MyArray[..NEWSIZE]
so my questions are as follows:
1. if I re-dimension the big array holding all the sub arrays will it clear out/free up/garbage collect all previously dimensioned sub-arrays and any data that they hold (which is what I want to happen)? If so, what is the syntax for doing that?
2. Can I declare the big holding array without knowing the size of the sub-arrays, and then re-dimension the sub-arrays as I need them? Again, what would be the required syntax?
To make it clearer, the workflow would be something like this:
'pseudo code open level data file Read in WAVE_COUNT re-dimension MyArray to be WAVE_COUNT-1 arrays of sub_arrays for x=0 to WAVE_COUNT-1 re-dimension sub_array[x] to newsize read path data into sub_array[x] next
I hope that this makes sense! :-)