Using new with arrays of arrays

BlitzMax Forums/BlitzMax Beginners Area/Using new with arrays of arrays

Ah I think I figured it out. Someone was having a problem and they did something like this and said it seemed backwards:

Scrambled_Dest = New Int[][WordsToDescramble]

This seems to work. I haven't yet tested it, but it compiles.

I think I understand why it works like this. You are asking for an array of size [WordsToDescramble] of Arrays of Int. "Array of Int" is the type, just as in Int[10] int is the type, so it goes before the array size declaration, [WordsToDescramble].

New Int[WordsToDescramble][] does not work, because you're telling New to make a new array of Int[WordsToDescramble]s, but not specifying how many of those you want.

But then to access it, I guess you have to access it backwards? Like so? Blah[Word][Letters]

That's my best guess at least right now.