TScript Variables Keyword (error, null, this)
The error keyword
The "error" keyword is a globally defined variable that records the error information for the current script. It is accessible from any position in any method throughout the TScript source code. It is defined as a TVariable::ERROR_MSG and contains two values, the errorCode and an errorString. This error code is set by equating the error variable to an integer and the error string is set by equating the error variable to an astring value
The null keyword
The "null" keyword is a locally defined variable that enables the temporary creation of TVariables that have no value and a type of null
The this keyword
From any method defined within a defined variable can access a "this" variable. This variable will allow the method to directly access variables contained with the defined variable. For example the following code declares a defined variable which contains a method that can access the "this" variable.
- TScript
public variable Class{ Integer height, width; Class(){ height = width = 10; } public getDimensions(: Integer width, Integer height){ width = this.width; height = this.height; } } main(){ Class a; variable b, c; a.getDimensions(:b,c); if(b < 5) return error = "B is too small"; System::ReportEvent("The Deimensions are "+a+" and "+b); }