Skip to content

static_cast

Builtin · cast

Source-level type annotation. Luau has no runtime casts — this does not check ClassName.

T static_cast<T>(value);
NameTypeDescription
TtypeTarget type, often Folder / Player.
valueanyExpression to re-annotate.

value unchanged, annotated as T.

value (with a Luau type annotation)

const_cast, reinterpret_cast, and dynamic_cast also emit the argument. (void)x; is dropped (silences unused in clangd).

To branch on Instance class at runtime, use match (IsA).

Folder folder = static_cast<Folder>(existingFolder);

Emits:

local folder: Folder = existingFolder

match · instance-pointer · auto