Lingo Dictionary > O-R > objectP() |  |

objectP()

Syntax

    objectP(expression)

Description

Function; indicates whether the expression specified by `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 Examples folder inside the Director application folder.

Example

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

    if objectP(gDataBase) then
    	nothing
    else
    	gDataBase = script("Database Controller").new()
    end if

See also

`floatP()`, `ilk()`, `integerP()`, `stringP()`, `symbolP()`