SetReturnValue

(Engine-Level Function)

Description: Sets the return value of a specified object if the object is not currently running a Return() statement in steady state.
Returns: Nothing
Usage: Script only.
Function Groups: Basic Module
Related to: HasReturnStatement | Return
Format: SetReturnValue(Object, Value[, Resettable])
Parameters:  
Object
Required. A reference to the object whose return value is to be changed.
Value
Required. The new return value.
Resettable
Optional Boolean. Defaults to TRUE. If present and set to FALSE, the return value will not reset to INVALID until another Return statement specifies otherwise. See comments.
Comments:

Returns 1 if successful, 0 on failure, or Invalid if the first parameter cannot be resolved to an object.

When an object is called within an If statement and its return value has been set using SetReturnValue, then the object’s return value will become Invalid when the If statement's script executes. This can be seen with the automatically resetting functions.

 

This behavior is not desirable for some called modules. The same goes for some modules that set their return value from script using Return. For these, set the parameter Resettable to FALSE.