-
Notifications
You must be signed in to change notification settings - Fork 0
typeName
ffredyk edited this page Jul 23, 2026
·
1 revision
Type / Introspection
Unary — typeName <value>.
typeName <any>
Returns the type name of a value as a lowercase string. Useful for runtime type checking and debugging.
| Value type | Returns |
|---|---|
| Number | "number" |
| String | "string" |
| Array | "array" |
| Code | "code" |
| Boolean | "boolean" |
| Nil | "nothing" |
| HashMap | "hashmap" |
| Namespace | "namespace" |
| ScriptHandle | "scripthandle" |
| Error | "error" |
| Shared | "shared" |
Reads the internal type tag from the value's wrapper struct and returns the corresponding string. O(1).
typeName 42; // "number"
typeName "hello"; // "string"
typeName [1, 2, 3]; // "array"
typeName { sleep 1; }; // "code"
typeName true; // "boolean"
typeName nil; // "nothing"
typeName createHashMap; // "hashmap"if (typeName _val != "number") then {
systemChat "Expected a number";
};switch (typeName _input) do {
case "number": { processNumber(_input); };
case "string": { processString(_input); };
case "array": { processArray(_input); };
default { systemChat "Unknown type"; };
};_assertType = {
params ["_val", "_expected"];
if (typeName _val != _expected) then {
throw f"Type mismatch: expected {_expected}, got {typeName _val}";
};
};ReadOnly — pure query. Safe from any scheduler.
- Getting Started
- Language Guide
- Type System
- Control Flow
- Functions & Code
- Strings & Text
- Arrays & Collections
- Concurrency
- Promise System
- Thread Safety
- Host API & Embedding
- CLI Tool
- Bytecode Reference
- Multiplayer
- Syntax Sugar
- Optimization Guide
- Benchmarks
- count
- select
- pushBack
- append
- deleteAt
- deleteRange
- resize
- reverse
- sort
- find
- in
- forEach
- freeze
- thaw
- isFrozen
- currentScheduler
- clientOwner
- allSchedulers
- schedulerName
- schedulerExists
- schedulerBudget
- setSchedulerBudget
- fiberCount
- readyFiberCount
- waitingFiberCount
- schedulerLoad
- sendTo