TScript Defined Variables
Defined Variables are used to implement class functionality and allow users to create a structure that has predefined variables, constants and methods.
The defined variable are declared as followed:- "[public] variable DefinedVariableName [extends RootDefinedVariableName] { }". Here as well as is static methods, the public keyword is similar to __declspec(dllexport), where this indicates that is the script is complited into a library, this static method will remain visible. The extends keyword allows users extend predefined variables.
Within the defined variable, a constructor can declared with the following syntax:- "DefinedVariableName([list of input parameters] [:[list of returning variables]]){ }". This method has no public keyword as it is always the same as the defined variable. Any root defined variable constructors are called before the extending defined variables.
Constants can be declared within the defined variable with the following syntax:- "[public] constant ConstantName = <value>". By convention the constant name all upper case, but is not enforced. The constant value can be of any TVariable type, including ASCII string. The constant is used by the syntax:- "DefinedVariableName.ConstantName", even inside the variable as linking of the constant is not done until run time.
Defined variable methods are declared with the following syntax:- "[public] DefinedMethodName([list of input parameters] [:[list of returning variables]]){ }". Within the method the "this" variable is defined and used to access values within the structure. The method will modify values within the "this" variable even if the method returns an error.