Redimming Arrays
Blitz3D Forums/Blitz3D Beginners Area/Redimming Arrays
| ||
EDITED* I think i figured it out...but not having redim blows! |
| ||
You can redim an array. "Arrays can be re-dimmed by using the Dim statement again with the same array name, but the contents of the array will be lost. " |
| ||
yeah, your best to create another temp array, and transfer the contents over, then re-dim, and copy back across. |
| ||
Banks can be resized without erasing existing data. Dont know if this helps you coz I didn't see your original post before you deleted it. |
| ||
yeh me either |
| ||
As long as you initially Dim an array in the main program you can Dim it again anywhere, including in functions, but as was said above, all the existing values will be deleted. A Redim command which preserves the data would be near to the top of my Blitz wishlist. As it stands, you need to have a spare array for each different array data type you might want to re-dimension - including custom type pointer arrays - which is ridiculous when all that is (mostly) required is a routine to copy the area of memory where the array data is stored. |
| ||
Memory fragmentation may be why ReDim is not implemented in BB3D. For performance make the array large enough to cope with the number of subscripts that may be used. |