On this page
API type

type

Runtime type inspection.

Syntax

Atlas Script
type

Return value

See the remarks for the returned value and runtime behavior.

Type-name constants

Every constant the native script registry defines for type, generated from the registry manifest.

Constanttype() result
type.arrayarray
type.boolbool
type.floatfloat
type.fontfont
type.handlehandle
type.int32int32
type.modelmodel
type.nullnull
type.stringstring
type.targettarget

Remarks

Runtime type inspection. type(value) returns a type-name string; whole numbers report int32 and fractional numbers report float. Compare common results with type.int32, type.float, type.string, type.bool, type.null, type.array, type.font, type.model, type.target, or type.handle. Structs and typed vision values return their specific type names, which do not have fixed type.* constants.

Examples

Use enums, functions, and type.atlas
enum Mode {
    idle,
    active = 5
};

function modeName(value) {
    if (value == Mode::active) {
        return "active";
    }
    return "idle";
}

var currentMode = Mode::active;

event on_frame() {
    string numericType = type(currentMode);
    ui.status(string.format("{} ({})", modeName(currentMode), numericType));
}
Reference details are generated from the Atlas Script schema in this documentation source snapshot. Confirm release-specific behavior in the Atlas for Windows build you use.