Redim array

BlitzMax Forums/BlitzMax Beginners Area/Redim array

How would i do this?

Thanks
Matt

myarray = myarray[..newsize]


Thanks. But now i'm getting an error which says incorrect number of array dimensions...but thats not right as i'm using 3 throughout.

Function populate_tiles(map:String)
	Local count:Int
	Local xCount:Int = 0
	Local yCount:Int = 0
	Local mapFile
	Local dataFile
	Local mapCode
	
	dataFile = ReadFile("data/maps.txt")
		xSize = Readint(dataFile)
		Print xSize
		ySize = Readint(dataFile)
		Print ySize
	CloseFile(dataFile)	
	mapFile = ReadFile(map)
	
	tiles=[xSize,ySize,3]
	
	For yCount = 1 To ySize
		For xCount = 1 To xSize
			mapCode = ReadByte(mapFile)
			
				tiles[xCount,yCount,2] = mapCode
			
		Next
	Next
	CloseFile(mapFile)
	
	FlushMem
End Function


tiles=[xSize,ySize,3]

Should be
tiles = New Int[xSize,ySize,3]


Nah, it should be:

tiles = New Int[ xSize + 1, ySize + 1, 3 + 1 ]

Since he's accessing the xSize-th element.

Ok this is a worrying error...unable to convert from Int Array to Int Array? Surely it shouldnt need to convert it?

How did you define it? It should be something like
Global tiles:Int[,,]
for a 3-dimensional array.

Michael's right about the sizes, by the way.