Is/will there be an Array.Resize() ?

About Monkey 2 Forums Monkey 2 Programming Help Is/will there be an Array.Resize() ?

This topic contains 4 replies, has 2 voices, and was last updated by  Diffrenzy 2 years, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4017

    Diffrenzy
    Keymaster

    I’m looking for the Monkey1 Array.Resize method, but can’t find it.

    What is the best way to upsize arrays in MX2? Should I attempt to build a Array<T> extention method? For now, I made this :

    #4024

    Mark Sibly
    Keymaster

    Yes there will.

    #4026

    Diffrenzy
    Keymaster

    Thanks 🙂

    #4035

    Mark Sibly
    Keymaster

    Just added a ‘1D’ resize and committed it.

    It works the same as mx1, ie: you can’t resize an array ‘in place’ – it always returns a new array.

    N-D versions of slice, resize etc will happen when I work out how to do them! In the meantime, you can use array methods on N-D arrays if you want, although they’ll always treat the N-D array as 1D, and return a 1D array.

    #4038

    Diffrenzy
    Keymaster

    Thanks!

    ‘1D’ tested and working well.

    “Collapsing” an N-D to might come in handy, when serializing to XML.

    If there was a New(oned<T>[],nsize:Int) we could go both ways 🙂

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

You must be logged in to reply to this topic.