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:
- Numbers:
123 - Strings:
"Hello, world!" - Booleans:
trueorfalse - Colors:
#ff0000 - Vectors:
@(1.5, 2) - Flags:
0b010110 - Symbols:
$mySymbol - Timestamp:
#2031-12-31
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
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
ArrowLeftorClick - Asset represents an image or sound file, e.g.
@spaceship.svgor@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.