Skip to content

Using Classes

Davis Brown edited this page Aug 28, 2018 · 3 revisions

Instantiation

Objects can be instantiated by invoking a function corresponding to the class's name. The following Example will instantiate an object of class ObjectWrappper and assign it to _x.

var _instance = ObjectWrapper();

Set/Get Variables

Variables can be accessed and modified using the dot operator

Get object variable _instance.containedObject

Set object variable _instance.containedObject = player;

Method Calls

Object methods can be accessed using the dot operator, and invoked similarly to normal functions.

_instance.isNull();

Copy Object

Copying an object will create a shallow copy of the supplied instance. A function named copy_constructor will be called if available.

copy _instance;

Object Deletion

In order to prevent memory leaks, objects must be deleted before their references are released. Deletion requires the use of the keyword delete with the right-side of the expression taking the variable containing the object instance.

delete _instance;

Clone this wiki locally