Lingo Dictionary > S > setaProp

 

setaProp

Syntax

setaProp list, listProperty, newValue
setaProp (childObject, listProperty, newValue)
list.listProperty = newValue
list[listProperty] = newValue
childObject.listProperty = newValue

Description

Command; replaces the value assigned to listProperty with the value specified by newValue. The setaProp command works with property lists and child objects. Using setaProp with a linear list produces a script error.

For property lists, setaProp replaces a property in the list specified by list. When the property isn't already in the list, Lingo adds the new property and value.

For child objects, setaProp replaces a property of the child object. When the property isn't already in the object, Lingo adds the new property and value.

The setaProp command can also set ancestor properties.

Example

These statements create a property list and then adds the item #c:10 to the list:

newList = [#a:1, #b:5]
put newList
-- [#a:1, #b:5]
setaProp newList, #c, 10
put newList

Example

Using the dot operator, you can alter the property value of a property already in a list without using setaProp:

newList = [#a:1, #b:5]
put newList
-- [#a:1, #b:5]
newList.b = 99
put newList
-- [#a:1, #b:99]

Note: To use the dot operator to manipulate a property, the property must already exist in the list, child object, or behavior.

See also

ancestor, property, . (dot operator)