Init 2D arry

BlitzMax Forums/BlitzMax Beginners Area/Init 2D arry

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.

array of arrays needs to be initialized. a little more work but they are more flexible (can slice)

' =======2D Array=======
Local array[10,10]

array[2,2] = 4
Print array[2,2]

array[5,5] = 25
Print array[5,5]

' ==========Array of Arrays===========
Local GRID[][]
Local GridWidth:Int = 10
Local GridDepth:Int = 15

Grid = Grid[..GridWidth]

For Local count:Int = 0 To GridWidth - 1
		GRID[count] = Grid[Count][..GridDepth]
Next
	
GRID = GRID[..GridWidth][..GridDepth]



GRID[2][2] = 4
Print GRID[2][2]

GRID[5][5] = 25
Print GRID[4][4]