How to resize multidimensional arrays?

Home Forums Monkey 2 Programming Help How to resize multidimensional arrays?

This topic contains 2 replies, has 2 voices, and was last updated by  Henry1975 4 months, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #9377

    Henry1975
    Participant

    Hi everyone!

    I’m standing a little bit on my line right now trying to resize a multidimensional array.

    This works:
    Local testString1:String[] = New String[1]
    testString1 = testString1.Resize(2)

    This throws errors in any Resize() combination I tried:
    Local testString2:String[,] = New String[1,2]
    testString2 = testString2.Resize(2,2)

    Anyone able to give me the solution?

    Thanks,
    Henry

    #9381

    TomToad
    Participant

    Two dimensional arrays cannot currently be resized. You need to roll your own function to do so. Here is an example function that works.

    #9392

    Henry1975
    Participant

    Many thanks Tom, I gonna implement this function in my code!

    Henry

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.