Compatible With ScriptsCompatible With ExpressionsCompatible With The Command Line

 

object GetPrevObject (object obj)

 

Return Value: The previous sibling above obj or 0 if one doesn't exist.

 

Arguments:

obj

object who's sibling you want
 

This function selects the object that is a sibling of obj and is located above obj in the item list. If that object doesn't exist then 0 will be returned. You can test for failure with an if statement:

 

object cameraObj = GetObject("Camera");
if( ! cameraObj ) return(0);
object obj  = GetChildObject( cameraObj );
if( ! obj ) return(0);

 

NOTE: It is far more efficient to pass a script function an object than it is to use this function in the script. If your script will execute very often, every frame perhaps, then you will want to keep your use of this function  to a minimum.

 

VERY IMPORTANT: DO NOT keep an object between calls to a script function, there is no guarantee that the object will still be there the next time the function is called. For example:

 

int someFunc( )
{
     static object obj = GetObject("Camera");
     // do something with obj
}

 

If the object "Camera" is deleted between calls to this function very bad things will happen. It is better to pass the Camera object as a variable to the function.

Converted from CHM to HTML with chm2web Pro 2.82 (unicode)