Types

Every value has exactly one type, drawn from a fixed, closed set. Types are dynamic: variables are not declared with a type, and a binding may hold values of different types over its lifetime. Type errors are detected at run time where an operation requires a specific type (Error conditions).

The type set

Type Name string Holds
null null the absence of a value
bool bool true / false
int int a 64-bit signed integer
string string a byte string
creature creature a live mobile or player
object object a live object instance
mob_proto mob_proto a mobile prototype, referenced by vnum
obj_proto obj_proto an object prototype, referenced by vnum
room room a room
iterable iterable an on-demand sequence (iterables)
block block a callable code value (blocks)
list list an ordered, heterogeneous aggregate

These name strings are what appear in run-time type-error messages.

Scalar types

null

null is the unit "no value." It is produced by an empty ()-free context such as a side-effecting command's result, by recall of an unstored slot, by a block with an empty body, and by return with no argument. null renders as the empty string (Properties of types and values). null is not a bool (Properties of types and values — Boolean contexts).

bool

true and false. Produced by the boolean literals (Constants), by comparison and predicate builtins, and by the logical operators and/or/not. The boolean contexts are enumerated in Properties of types and values.

int

A signed 64-bit integer. Produced by integer literals, arithmetic builtins (+ - * / %), int, and various query builtins (level, vnum, gen, hour, …). Division and modulo by zero are run-time errors.

string

A byte string. Produced by string literals, interpolation, the string query builtins (name, class, position, pronoun builtins, …), the string-transforming builtins (upper, lower, substr), and the string form of any value via interpolation/concatenation (Built-in functions).

Entity reference types

An entity reference denotes a specific game entity.

A creature or object reference whose entity has since been destroyed is stale (Error conditions).

iterables

An iterable is an on-demand sequence. Iterables are the language's universal "collection" — there are no arrays of game entities, only iterables over them. The builtins that produce and consume iterables are cataloged in Built-in functions.

The iterables produced by select and slice are deferred: they produce their elements on demand as they are consumed, rather than computing them up front. Strings are not iterable directly — to iterate words, convert with words (Built-in functions). Binding behavior is specified in Properties of types and values.

blocks

A block is a first-class callable code value (Blocks).

list

A list is an ordered, fixed-length aggregate of heterogeneous values, written ( … ) (Expressions). A list is iterable (iterating a list walks its elements), and is the way to write a literal heterogeneous sequence — e.g. a list of predicate blocks.

Equality, rendering, and binding behavior are covered in Properties of types and values. To test whether a list is non-empty, use [empty $l] or [gt [count $l] 0] — a list is not itself a bool.