Using multidimensional arrays
One-dimensional arrays are simple lists of information. Multidimensional arrays can hold related data in columns and rows such as with a spreadsheet. This recipe will show you how to create, populate, and retrieve information from a multidimensional array.
How to do it...
Perform the following steps to create and use multidimensional arrays:
Create a new main stack in LiveCode.
On the stack or card, create the following code to create a two-dimensional array and populate it with three rows of information:
command makemyarray local aMyArray put "J" into aMyArray[1][1] put "Jones" into aMyArray[1][2] put "United States" into aMyArray[1][3] -- put "R" into aMyArray[2][1] put "Smith" into aMyArray[2][2] put "United Kingdom" into aMyArray[2][3] -- put "T" into aMyArray[3][1] put "Johnson" into aMyArray[3][2] put "Canada" into aMyArray[3][3] end makemyarray
Use the following line of code to retrieve a specific piece of information. In this case...