Dynamic Resizing

BlitzMax Forums/BlitzMax Beginners Area/Dynamic Resizing

@ extron:

I've expanded your code too to this:
Type toto
	Field index:Int[][]

	Method Init(val:Int, val1:Int)
		index=index[..val+1]
		index[val]=index[val][..val1]
	End Method
End Type

SeedRnd(MilliSecs())

' We create a new type toto
ex:toto=New toto

' We initialize first array to 10 (indexes 0..9) and second array to a random size (from 1 to 10)
For i = 0 To 9
	ex.init(i, Rand(1, 10))
Next

' Fill each index with a random number
For i = 0 To (ex.index.length - 1)
	For j = 0 To (ex.index[i].length - 1)
		ex.index[i][j] = Rand(1, 100)
	Next
Next

' Print all numbers
For i = 0 To (ex.index.length - 1)
	For j = 0 To (ex.index[i].length - 1)
		Print "ex.index[" + i + "][" + j + "]: " + ex.index[i][j]
	Next

	Print
Next


Now you have two fully working examples which you can use, PaulJG.

But I have to admit, Extron's code is easier to understand and follow.