Redimming Arrays

Blitz3D Forums/Blitz3D Beginners Area/Redimming Arrays

Gauge(Posted 2004) [#1]
EDITED* I think i figured it out...but not having redim blows!


Stoop Solo(Posted 2004) [#2]
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. "


Ross C(Posted 2004) [#3]
yeah, your best to create another temp array, and transfer the contents over, then re-dim, and copy back across.


big10p(Posted 2004) [#4]
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.


Agamer(Posted 2004) [#5]
yeh me either


Zethrax(Posted 2004) [#6]
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.


Graythe(Posted 2004) [#7]
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.