I think what Jacque wanted was a more direct way to get the elements at any level of a multi-dimensional array. She certainly knows that, given:
on mouseUp put "X" into myArray[a][b][c] put "Y" into myArray[a][b][d] put myArray[a][b] into newArray end mouseUp newArray gives: c X d Y and that one can loop through whatever level of the array is of interest (the third in this case) to finally find: X Y A function can be written, as Jacque mentioned, to find this sort of thing with the desired level described as a parameter. I just thought that it would be useful to have that very thing: put elementsOrArray(theArray,theElement) into newArray as a native function. Craig -----Original Message----- From: Jacques Hausser <jacques.haus...@unil.ch> To: How to use LiveCode <use-livecode@lists.runrev.com> Sent: Sun, Jun 16, 2013 6:40 pm Subject: Re: Manipulating parts of a multi-dimensional array I'm not sure to understand your question correctly. if your array has four "first level" elements: myArray["a"] myArray["b"] myArray["c"] myArray["d"] and that e.g. myArray["c"] has three "second level" elements myArray["c"]["x"] myArray["c"]["y"] myArray["c"]["z"] which in turn contain several "third level" elements, e.g. myArray["c"]["y"][1] myArray["c"]["y"][2] myArray["c"]["y"][3] you can perfectly well < put myArray["c"]["y"] into NewArray > , which will have elements NewArray[1] NewArray [2] NewArray[3] NewArray[2] and myArray["c"]["y"][2] will have the same content. And after changing these contents (you can even replace them by other arrays) you can do the reverse put newArray into myArray["c"]["y"] oh, I didn't see that you got answers already - Colin's says the same thing more concisely - well I send this one nevertheless. To answer your question rather than to read your answer is such an exceptional situation I'll not miss it ;-) Jacques Le 16 juin 2013 à 21:26, J. Landman Gay <jac...@hyperactivesw.com> a écrit : > I have a big array with lots of dimensions. Sometimes I need to work with a "sub-dimension" only. For example: > > array[a][b][c][d] > > Each of those elements contains many other elements: > > [c][x][y][z] > > > which each contain more elements: > > [c][x][1][2][3] > > Suppose I only want to work with [c][x] and all its sub-dimensions. Is there an efficient way to extract that into its own array without looping through all the [c] keys? > > -- > Jacqueline Landman Gay | jac...@hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ****************************************** Prof. Jacques Hausser Department of Ecology and Evolution Biophore / Sorge University of Lausanne CH 1015 Lausanne please use my private address: 6 route de Burtigny CH-1269 Bassins tel: ++ 41 22 366 19 40 mobile: ++ 41 79 757 05 24 E-Mail: jacques.haus...@unil.ch ******************************************* _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode