User Guide
offset() (string function) 433
objectP()
Usage
objectP(expression)
Description
Function; indicates whether a specified expression is an object produced by a parent script, Xtra,
or window (
TRUE) or not (FALSE).
The P in
objectP stands for predicate.
It is good practice to use
objectP to determine which items are already in use when you create
objects by parent scripts or Xtra instances.
To see an example of
objectP() used in a completed movie, see the Read and Write Text movie
in the Learning/Lingo folder inside the Director application folder.
Parameters
expression
Required. Specifies the expression to test.
Example
This Lingo checks whether the global variable gDataBase has an object assigned to it and, if not,
assigns one. This check is commonly used when you perform initializations at the beginning of a
movie or section that you don’t want to repeat.
-- Lingo syntax
if objectP(gDataBase) then
nothing
else
gDataBase = script("Database Controller").new()
end if
// JavaScript syntax
if (objectP(gDataBase)) {
// do nothing
} else {
gDataBase = script("Database Controller").new();
}
See also
floatP(), ilk(), integerP(), stringP(), symbolP()
offset() (string function)
Usage
offset(stringExpression1, stringExpression2)
Description
Function; returns an integer indicating the position of the first character of a string in another
string. This function returns 0 if the first string is not found in the second string. Lingo counts
spaces as characters in both strings.
On the Macintosh, the string comparison is not sensitive to case or diacritical marks. For
example, Lingo considers a and Å to be the same character on the Macintosh.