Resizing and Deleting Arrays
BlitzMax Forums/BlitzMax Beginners Area/Resizing and Deleting Arrays| 
 | ||
| I've completely forgotten how to resize an already existing array, as well as delete/release/free existing arrays. Any help is appreciated, thanks. | 
| 
 | ||
| Deleting an array, just like any other object, is as simple as setting the variable to Null. See MaxIDE Help > Language > Slices for resizing. | 
| 
 | ||
| From the help: (help -> language -> advanced topics -> slicing) Local a[200] 'initialize a[] to 200 elements a=a[50..150] 'extract middle 100 elements of a[] a=a[..50] 'extract first 50 elements of a[] a=a[25..] 'extract elements starting from index 25 of a[] a=a[..] 'copy all elements of a[] a=a[..200] 'resize a[] to 200 elements | 
| 
 | ||
| Which is fine when you are dealing with a single array dimension but it get's confusing when you need multiple dimensions, does slicing work for multiple dimensions e.g. Local a[200,200] a=a[50..150,50..150] 'middle 100,100 element of a[] a=a[..50,..50] 'extract first 50 elements of a[] a=a[25..,25..] 'extract elements starting from index 25 of a[] a=a[..,..] 'copy all elements of a[] a=a[..200,..200] 'resize a[] to 200 elements ? | 
| 
 | ||
|  ...does slicing work for multiple dimensions[?] No. | 
| 
 | ||
|  does slicing work for multiple dimensions e.g.  No -- I just tried it, and got the following error: "Slices can only be used with strings or one dimensional arrays" |