| AngelScript

Registering an object type

The are two principal paths to take when registering a new type, either the type is a reference type that is located in dynamic memory, or the type is a value type that is located on the stack or locally as members of other objects. A reference type support object handles (unless restricted by application) but cannot be passed by value to application registered functions, a value type doesn't support handles and can be passed by value or reference to application registered functions.

There is no given rule when to use one or the other, but in general you'll use reference types when the type must be able to outlive the scope in which it is created, and value types when the type is normally used to perform quick calculations after which the object can be discarded. If the type is large or complex, then it is likely it should be a reference type.

- Registering a reference type
- Registering a value type
- Registering operator behaviours
- Registering object methods
- Registering object properties