HISE Logo Forum
    • Categories
    • Register
    • Login

    Having a hard time with panel.setValue() syntax

    Scheduled Pinned Locked Moved Scripting
    7 Posts 2 Posters 78 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.
    • VirtualVirginV
      VirtualVirgin
      last edited by

      I have some panel data that was being set like this in a loop:

      rack.data["row" + i] = panel;
      

      and

      rack.data.rows[i] = panel;
      

      and instead I am trying to save this in the panel's value

      I am using:

      		rack.setValue(
      		{
      			["row" + i]: panel,
      			"rows"[i]: panel
      		});
      

      but I am just getting errors from this such as:
      '''
      Found '[' when expecting identifier
      '''

      I've been fiddling around with the syntax to try to get it work, but I just can't seem to get it.

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

        @VirtualVirgin You can't use an array as a key.

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

        VirtualVirginV 1 Reply Last reply Reply Quote 0
        • VirtualVirginV
          VirtualVirgin @d.healey
          last edited by

          @d-healey
          I've tried this:

          		rack.setValue
          		({
          			"row" + i: panel,
          		});
          

          but it says:

          Found '+' when expecting ':'
          
          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @VirtualVirgin
            last edited by

            @VirtualVirgin Try putting it in ()

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

            VirtualVirginV 1 Reply Last reply Reply Quote 0
            • VirtualVirginV
              VirtualVirgin @d.healey
              last edited by

              @d-healey
              I'm not sure which "it" you meant, so I tried all combinations:

              "row" (+) i: panel
              "row" + (i): panel
              ("row") + i: panel
              ("row" + i): panel
              ("row" + i: panel)
              "row" + i: (panel)
              "row" + i(:) panel
              

              All of those throw an error

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

                Yeah it looks like it doesn't work in HISE script. You'll need to create the key separately, like this

                const i = 10;
                const key = "row" + i;
                const myObj = {key: "Hello"};
                
                Console.print(trace(myObj));
                

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

                VirtualVirginV 1 Reply Last reply Reply Quote 0
                • VirtualVirginV
                  VirtualVirgin @d.healey
                  last edited by

                  @d-healey Thank you!

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

                  51

                  Online

                  1.7k

                  Users

                  11.7k

                  Topics

                  101.8k

                  Posts