O'Reilly logo

Lingo in a Nutshell by Bruce A. Epstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required