Table of Contents

TatVirtualMachine.ExecuteSubroutine Method

Executes a specific routine declared in the script associated with this virtual machine.

Remarks

ALabel must contain the name of the routine to be executed; the comparison is case-insensitive. If the routine does not exist, an exception is raised. Use TatScriptInfo.RoutineByName to check whether a routine exists before calling this method. The Input parameter can be a single Variant value, an array of Variant, or an array of const. These values are passed as parameters to the script routine. To update a parameter declared by reference (e.g., var MyParam: integer), use the array-of-const overload and pass a variable of type Variant. The return value contains the value returned by the called function.

Syntax

Unit: atScript

function TatVirtualMachine.ExecuteSubroutine(ALabel: string; Input: Variant): Variant; overload;

Parameters

<-> Parameter Type Description
ALabel string
Input Variant

Examples

//script procedure MultiplyMyVar(var AValue: integer; AFactor: integer); begin AValue := AValue * AFactor; end; //Delphi var SomeVar: Variant; //MUST BE of Variant type begin SomeVar := 10; atScripter1.ExecuteSubroutine('MultiplyMyVar', [SomeVar, 3]); //At this point, SomeVar will have value of 30 end;

See also