User Guide

40 Chapter 2: Director Scripting Essentials
The following statements illustrate defining the linear list workerList that contains one value,
Heather, and then adds Carlos as the second value in the list.
-- Lingo syntax
workerList = ["Heather"] -- define a linear list
workerList[2] = "Carlos" -- set the second value using the equal operator
workerList.setAt(2, "Carlos") -- set the second value using setAt()
// JavaScript syntax
var workerList = list("Heather"); // define a linear list
workerList[2] = "Carlos"; // set the second value using the equal operator
workerList.setAt(2, "Carlos"); // set the second value using setAt()
To retrieve a value in a linear list:
Use the list variable followed by the number that indicates the values position in the list. Place
square brackets around the number.
Use the getAt() method.
The following statements create the linear list
workerList, and then assign the second value in
the list to the variable
name2.
-- Lingo syntax
workerList = ["Bruno", "Heather", "Carlos"] -- define a linear list
name2 = workerList[2] -- use bracketed access to retrieve "Heather"
name2 = workerList.getAt(2) -- use getAt() to retrieve "Heather"
// JavaScript syntax
var workerList = list("Bruno", "Heather", "Carlos");
var name2 = workerList[2] // use bracketed access to retrieve "Heather"
var name2 = workerList.getAt(2) // use getAt() to retrieve "Heather"
To set a value in a property list, do one of the following:
Use the equals (=) operator.
In Lingo only, use the setaProp() method.
Use dot syntax.
The following Lingo statement uses the equals operator to make
sushi the new value associated
with the property
Bruno.
-- Lingo syntax
foodList = [:] -- define an empty property list
foodList[#Bruno] = "sushi" -- associate sushi with Bruno
The following Lingo statement uses setaprop() to make sushi the new value associated with
the property Bruno.
-- Lingo syntax
foodList = [:] -- define an empty property list
foodList.setaProp(#Bruno, "sushi") -- use setaProp()
// JavaScript syntax
foodList = propList() -- define an empty property list
foodList.setaProp("Bruno", "sushi") -- use setaProp()
The following statements use dot syntax to set the value associated with Bruno from sushi to
teriyaki.