Skip to content


Classes, or structs, are a way to group a collection of values together, similiar to a mapping. A class holds a pre-defined number of member values which are accessed by their given name.

To use a class across multiple code files, it is ideal to have a shared inheritable for the class definition. Do not use include statements.

Define what the class will look like:

class Person {
    string name;
    int level;

Create an empty instance of the Person class:

    class Person npc = new(class Person);

Create an instance of the Person class with passed values:

    class Person npc = new(class Person, name: "Name", level: 15);

Accessing member values using dot operator:

c = "Name";
    npc.level = 15;

Accessing member values using arrow operator:

    npc->name = "Name";
    npc->level = 15;