Director Help

Creating multidimensional lists

You can also create multidimensional lists that enable you to work with the values of more than one list at a time.

In the following example, the first two statements create the separate linear lists list1 and list2. The third statement creates a multidimensional list and assigns it to mdList. To access the values in a multidimensional list, the fourth and fifth statements use brackets to access the values in the list; the first bracket provides access to a specified list, and the second bracket provides access to the value at a specified index position in the list.

-- Lingo syntax
list1 = list(5,10)
list2 = list(15,20)
mdList = list(list1, list2)
trace(mdList[1][2]) -- displays 10
trace(mdList[2][1]) -- displays 15

// JavaScript syntax
var list1 = list(5,10);
var list2 = list(15,20);
var mdList = list(list1, list2);
trace(mdList[1][2]); // displays 10
trace(mdList[2][1]); // displays 15