HISE Logo Forum
    • Categories
    • Register
    • Login

    Concatenate multiple arrays into one

    Scheduled Pinned Locked Moved General Questions
    7 Posts 3 Posters 282 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      LeeC
      last edited by LeeC

      Hey guys,

      Thought this would be really simple but there's isn't a ".concat" method in Hise ☹

      I'm just simply trying to get the following arrays:

      var arrayA = [ 1, 2, 3];
      var arrayB = [ 4, 5, 6];
      var arrayC = [ 7, 8, 9];

      Merged into one new array so that the output is:

      NewArray = [ 1, 2, 3, 4, 5, 6, 7, 8, 9]

      Any thoughts?

      Cheers

      L 1 Reply Last reply Reply Quote 0
      • L
        LeeC @LeeC
        last edited by LeeC

        @LeeC I guess looping through each array and pushing values to the new array is the way forward.
        I just hoped that there would be a simpler method as I have to do this for quite a lot of arrays.

        1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey
          last edited by

          I have a concatenate function in my github repo - https://github.com/davidhealey/HISE-Scripting-Framework/blob/master/libraries/objectHelpers.js

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          L 1 Reply Last reply Reply Quote 1
          • L
            LeeC @d.healey
            last edited by

            @d-healey thanks for this.

            Also, do you know how to use the following ".sort" in HISE to order an array ascending numerically?

            array.sort();

            Cheers

            1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey
              last edited by

              const var arr = [5, 3, 6, 7, 1];
              arr.sort();
              Console.print(trace(arr));
              

              Libre Wave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              ustkU 1 Reply Last reply Reply Quote 2
              • ustkU
                ustk @d.healey
                last edited by

                @d-healey I didn't know about the trace method 😎

                Can't help pressing F5 in the forum...

                d.healeyD 1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey @ustk
                  last edited by

                  @ustk I have a video about it on Patreon. :)

                  Libre Wave - Freedom respecting instruments and effects
                  My Patreon - HISE tutorials
                  YouTube Channel - Public HISE tutorials

                  1 Reply Last reply Reply Quote 1
                  • First post
                    Last post

                  48

                  Online

                  1.7k

                  Users

                  11.7k

                  Topics

                  101.8k

                  Posts