Lingo List Commands

The names of Lingo’s list-related commands suck. You’ll probably leave the O’Reilly bookmark (included at the back of this book) planted firmly in this chapter. See "Making Sense of List Commands" later in this chapter for hints on finding the right list command, or create wrapper scripts that use names that are easier to remember but simply call a single Lingo function, such as:

on getPropByValue myList, value
  -- Return the value obtained from getOne
  return getOne (myList, value)
end

Refer to Chapter 3, for details on wrapper scripts.

Some list commands work with both linear lists and property lists, but others work exclusively with one or the other. The same list command may behave differently or accept different arguments when used with different list types. There are multiple commands that have the same effect on certain list types.

Tip

Using the wrong type of list, or a non-list, as the first argument to a list function will cause the (highly misleading) "Handler not defined" error. See Example 3-21.

Use listP() or ilk() to check if your variable is the correct type of list. (See Example 5-3 under "Boolean Properties and Logical Operators" in Chapter 5 for important details.) If necessary, initialize the list inside the current handler, or declare it as a global variable if it is defined elsewhere.

Many list functions do not return a meaningful value. Instead, they modify the list used as the first argument. You cannot use the following syntax because add() does ...

Get Lingo in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.