Quick introduction to AngelScript

Here is a list of syntactic differences between AngelScript and other similar languages, such as C++.

Primitive data types

Primitives in AngelScript have direct matches in C++:

Name Size (bits)
bool 8
double 64
float 32
int8 8
int16 16
int 32
int64 64
uint8 8
uint16 16
uint 32
uint64 64
void 0

Object references

AngelScript has no C-like pointers, however, its object-handles behavior is similar to Java and C# references:

  • Use is (equal) or !is (not equal) as equality operators.
  • The operator @ marks object handles:
MyObject @obj = null;
MyObject @obj2 = GetMyObjectHandle();
@obj = @obj2;
if (obj is null)
    // ...
else if (obj2 !is null)
    // ...


Declare arrays by appending [] brackets to the type name. 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;

ab, 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. The elements can also be individually initialized by specifying an initialization list. Example:

int[] a;    // A zero-length array of integers
int[] b(3); // An array of integers with 3 elements
int[] c = {,3,4,}; // An array of integers with 4 elements, where
                   // the second and third elements are initialized

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[0] = some_value;

An array also has the following methods:

void insertAt(uint index, const T& in);
void removeAt(uint index);
void insertLast(const T& in);
void removeLast();
uint length() const;
void resize(uint);
The content above has been adapted from the original AngelScript documentation.

Handle arrays and handle to arrays

To declare an array of handles, use:

MyObject@[] objects;

To declare a handle to an array, put the @ after the brackets:

MyObject@[]@ arrayOfObjectArrays;
int[]@ handleToArrayOfIntegers;