Luau typing quick reference
Luau 0.731 · --!strictA practical introduction for Lua developers: annotations, arrays, dictionaries, records, unions, generics, module types, casts, and runtime freezing.
Luau types find mistakes during luastra check; they do not change runtime values. Put --!strict on the first line so the analyzer checks arguments, return values, table fields, and unhandled state variants.
Luau has no separate struct keyword, and standalone Luau has no universal Enum. Record types describe structures, singleton unions describe enum-like values, and tagged unions describe state with different fields.
Every example below is self-contained and checked by the documentation validator. Uncomment only the explicitly marked error line when practising how to read a failing luastra check.
Types disappear after analysis and do not verify server, storage, or form payloads. Validate unknown runtime data with luastra/data; use table.freeze separately when runtime immutability is required.