Skip to main content

Types

Easel has a number of built-in types which are used to represent different kinds of values.

Primitive Types

Values in Easel can be of primitive types, such as:

There is also a special type called null, which is used to represent a value which is present but is nothing, whereas undefined indicates the absence of a value.

Collection Types

  • Arrays: [1, 2, 3]
  • Maps: { key1 = "value1", key2 = "value2" }
  • Range: Range(0, 10)

Game-Specific Types

  • Entity represent objects in the game world
  • Polygon represents shapes, e.g. Circle(radius=5)
  • Category is used to determine which physical objects can interact with each other
  • Keycode represents a key on the keyboard, mouse or gamepad, for example ArrowLeft or Click
  • Asset represents an image or sound file, e.g. @spaceship.svg or @explosion.mp3

Programming Types

  • Callback represents a function that can be called at a later time, e.g. || { Hello }

There are a number of other types available as well - explore the full list in the sidebar to learn more.

Type Classes

If a type is null or undefined it is considered nullish. Values that are non-zero are considered truthy.

Only certain values can be used as keys in a Map. These are called Keyable values.

And only certain values can be saved to disk or transmitted across the network. These are called Sendable values.