Forum

    • Register
    • Login
    • Search
    • Categories

    Concatenate multiple arrays into one

    General Questions
    3
    7
    47
    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.healey
          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.healey
              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

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

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

                Tired to press F5 in the forum...
                Studio427 Audio - Audio Instruments & FX Plugins for music production. Website - Facebook

                d.healey 1 Reply Last reply Reply Quote 0
                • d.healey
                  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

                  12
                  Online

                  855
                  Users

                  5.7k
                  Topics

                  53.0k
                  Posts