HISE Logo Forum
    • Categories
    • Register
    • Login

    How do I declare this array?

    Scheduled Pinned Locked Moved Solved Scripting
    2 Posts 1 Posters 17 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.
    • Oli UllmannO
      Oli Ullmann
      last edited by

      Hello everyone! :-)

      How do I declare the msoXModulationTempSave array so that the msoXModulationTempSave[layerIndex][i][j][0] assignment works in the for loop?

      I get the following error message:
      Cannot assign to this expression!

      Many thanks,
      Oli

      for(i = 0; i < allGlobalMods.length; i++)
      {
        for(j = 0; j < 16; j++)
        {
          if(!mm.canConnect(allGlobalMods[i].getId(), allXKnobs[layerIndex][j].get("matrixTargetId")))
          {
            msoXModulationTempSave[layerIndex][i][j][0] = allGlobalMods[i].getId();	// save source id
            Console.print(msoXModulationTempSave[layerIndex][i][j][0]);
          }
        }
      }
      
      1 Reply Last reply Reply Quote 0
      • Oli UllmannO
        Oli Ullmann
        last edited by

        GPT gave me this and it works...:

        const msoXModulationTempSave = [];
        
        const var NUM_LAYERS = 4;
        const var I_SIZE     = 16;
        const var J_SIZE     = 8;
        const var K_SIZE     = 2;  // weil du [..][..][..][0] benutzt, mind. 1 Element
        
        for (l = 0; l < NUM_LAYERS; l++)
        {
            msoXModulationTempSave.push([]);
            for (i = 0; i < I_SIZE; i++)
            {
                msoXModulationTempSave[l].push([]);
                for (j = 0; j < J_SIZE; j++)
                {
                    // letzte Dimension mit Nullen füllen
                    var last = [];
                    for (k = 0; k < K_SIZE; k++) last.push(0);
                    msoXModulationTempSave[l][i].push(last);
                }
            }
        }
        
        1 Reply Last reply Reply Quote 0
        • Oli UllmannO Oli Ullmann has marked this topic as solved
        • First post
          Last post

        23

        Online

        2.0k

        Users

        12.8k

        Topics

        111.3k

        Posts