
87
•
In the upper text field of the Expression window, type the name of the function and
its arguments in parentheses. For example, to define a function named
cubed
that
takes one argument, you would type:
•
Press the return / enter key to move to the lower text field in the Expression window.
•
On the lower line, type in the definition of your function as an expression. You can
reference other variables if desired. The example below just multiplies the function
argument a by itself twice to raise the input to the third power.
•
Click OK to save your new function. The function now appears in the Functions
folder in the Project Browser. Click the disclosure triangle next to Functions to see it.
Operating on Vectors
A vector (also known as an array or list), is a variable that holds more than one element
(number). The Lemur expression syntax allows operations on vectors and access to the
elements. You can access the data in certain Lemur objects (Multislider, Multiball, Pads,
Switches) as vectors. Typically each “sub object” is an element of a vector. For example,
the x coordinates of the balls in a Multiball object are accessed as
myball.x[0]
myball.x[1]
etc.