How do I declare this array?
-
Hello everyone! :-)
How do I declare the
msoXModulationTempSavearray so that themsoXModulationTempSave[layerIndex][i][j][0]assignment works in the for loop?I get the following error message:
Cannot assign to this expression!Many thanks,
Olifor(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]); } } } -
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); } } } -
O Oli Ullmann has marked this topic as solved