I quote the documentation:
BlitzMax also does not support a 'Redim' operation. Instead, you can use slices. For example:
Global my_array$[100] 'create a 100 element string array
my_array=my_array[..200] 'now a 200 element array!
My question:
Does resizing the array, where my_array=my_arrays[..oldsize+extra], keep the original contents of the array, or does it just give you a bigger empty array that forgets what was stored in it?
If I store 100 numbers in the array and use [..200] to make it bigger, will those 100 numbers still be there?
Does doing this involve some kind of a memory copy - ie does it make a new 200 element array and copy the content from the old one? If it makes a new array but *doesn't* copy the content, do I have to do that myself?
Also, on the topic of arrays.... I notice you can't use EachIn as a loop counter where the array is an array of function pointers? ie
where myfunctions[] is an array of function pointers...
doesn't compile. ???
BlitzMax also does not support a 'Redim' operation. Instead, you can use slices. For example:
Global my_array$[100] 'create a 100 element string array
my_array=my_array[..200] 'now a 200 element array!
My question:
Does resizing the array, where my_array=my_arrays[..oldsize+extra], keep the original contents of the array, or does it just give you a bigger empty array that forgets what was stored in it?
If I store 100 numbers in the array and use [..200] to make it bigger, will those 100 numbers still be there?
Does doing this involve some kind of a memory copy - ie does it make a new 200 element array and copy the content from the old one? If it makes a new array but *doesn't* copy the content, do I have to do that myself?
Also, on the topic of arrays.... I notice you can't use EachIn as a loop counter where the array is an array of function pointers? ie
where myfunctions[] is an array of function pointers...
For counter=EachIn myfunctions myfunctions[counter](param) Next
doesn't compile. ???