Slices - What's wrong here?

BlitzMax Forums/BlitzMax Programming/Slices - What's wrong here?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Im pretty sure this is how array o' arrays works.

Local a:myObject[][]
a = new myObject[][5]
for i = 0 to 4
  a[i] = new myObject[5]
  for j = 0 to 4
    a[i][j] = new myObject
  next
next

'slice both x and y to +1
a = a[..a.length+1]
for i = 0 to a.length-1
  a[i] = a[i][..a[i].length+1]
next


That's a lot of slicing for a large arrays. These are best used if your data wouldn't fill up a whole grid. Like this
a[0] = {1,2,3}
a[1] = {1,2,3,4,5,6,7}
a[2] = {2}
a[3] = {1,3,56,3312,17,98,111}