index

Data types

Note that the host application may add types specific to that application, refer to the application's manual for more information.

void

void is not really a data type, more like lack of data type. It can only be used to tell the compiler that a function doesn't return any data.

bool

bool is a boolean type with only two possible values: true or false. The keywords true and false are constants of type bool that can be used as such in expressions.

int, int8, int16

int holds integer values in the range -2147483648 to 2147483647.

int8 holds integer values in the range -128 to 128.

int16 holds integer values in the range -32768 to 32767.

As the scripting engine has been optimized for 32 bit datatypes, using the smaller variants is only recommended for accessing application specified variables. For local variables it is better to use the 32 bit variant.

int32 is an alias for int.

uint, uint8, uint16

uint holds integer values in the range 0 to 4294967295.

uint8 holds integer values in the range 0 to 255.

uint16 holds integer values in the range 0 to 65535.

As the scripting engine has been optimized for 32 bit datatypes, using the smaller variants is only recommended for accessing application specified variables. For local variables it is better to use the 32 bit variant.

uint32 is an alias for uint.

float

float holds real (or floating point) values in the range -/+3.402823466e38.

The smallest possible positive number that a float can destinguish is: 1.175494351e-38. The maximum number of decimal digits that can be safely used is 6, i.e. if more digits are used they are prone to rounding errors during operations.

Curiousity: Floats may also have the additional values of positive and negative 0 or infinite, and NaN (Not-a-Number). NaN is represented by the 32 bit data word 0x7fc00000.

double

double holds real (or floating point) values in the range -/+1.7976931348623158e+308.

The smallest possible positive number that a double can destinguish is: 2.2250738585072014e-308. The maximum number of decimal digits that can be safely used is 15, i.e. if more digits are used they are prone to rounding errors during operations.

Curiousity: Doubles may also have the additional values of positive and negative 0 or infinite, and NaN (Not-a-Number).

bits, bits8, bits16

bits is a data type that allows manipulation of individual bits. The data type holds 32 bits in a word. It can be assigned by a bits constant that is written as a hexadecimal number, e.g. 0xDEADC0DE.

bits8 holds 8 bits, and bits16 holds 16 bits.

bits32 is an alias for bits.

Both float and int can be converted to and from bits.

The bits in the data type can be manipulated through the many bitwise operators available: & | ^ ~ << >> >>>

As the scripting engine has been optimized for 32 bit datatypes, using the smaller variants is only recommended for accessing application specified variables. For local variables it is better to use the 32 bit variant.

any

any is a special data type that can hold the value of any other type. Think of it as a generic container.

Two methods store() and retrieve() is used to manipulate the value held by the container.

object obj;             // An object that supports object handles
any container;
container.store(@obj);  // The @ operator is necessary to show that it is the handle that should be stored

...

object@ handle;
container.retrieve(@handle);  

When calling the method store() the previous value held by the container is released, and replaced with a copy of the new value. In the case of object handles, only the handle is copied, i.e. the object itself remains the same.

When calling retrieve() and passing a variable, the variable is only assigned a copy of the value held by the container if the type of the variable is compatible with the value.

Note: Currently only object handles can be stored by the any type, but future versions will allow all types. The any type will also receive another method for querying information about the type held by the container.

Type modifiers

It is also possible to declare array variables by appending the [] brackets to the type.

When declaring a variable with a type modifier, the type modifier affects the type of all variables in the list. Example:

int[] a, b, c;

a, b, and c are now arrays of integers.

When declaring arrays it is possible to define the initial size of the array by passing the length as a parameter to the constructor. Example:

TYPE[] a;
TYPE[] b(LENGTH);

a is an empty array of TYPE. b is an array with the length of LENGTH. Each element in the array is accessed with the indexing operator. The indices are zero based, i.e the range of valid indices are from 0 to length - 1.

a[INDEX] = EXPRESSION;

Object handles are a special type that can be used to hold references to other objects. When calling methods or accessing properties on a variable that is an object handle you will be accessing the actual object that the handle references, just as if it was an alias.

obj@ a;

a is here a handle to an object of type obj. Note that unless initialized with the handle of an object, the handle is null.

Not all types allow a handle to be taken. Neither of the primitive types can have handles, and there may exist some object types that do not allow handles. Which objects allow handles or not, are up to the application that registers them.

Object handle and array type modifiers can be combined to form handles to arrays, or arrays of handles, etc.

Strings

Strings are a special type of data that can be used only if the application registers support for them. They are a special data type that holds an array of bytes. The only limit to how large this array can be is the memory available on the computer.

Constant strings are written between double quotation marks ("). Inside the constant strings some escape sequences can be used to write exact byte values that might not be possible to write in your normal editor. If more than one string constants are written in sequence with only whitespace or comments between them the compiler will concatenate them into one constant.

sequence value description
\0  0 null character
\\  92 back-slash
\"  34 double quotation mark
\n  10 new line feed
\r  13 carriage return
\xFF  0xFF FF should be exchanged for the hexadecimal number representing the byte value wanted

top