Record types
Luau 0.731 · --!stricttype Name = { field: Type }A table type is Luau's struct-like construct. The analyzer checks required fields and their value types.
When to use it
Read this page when you need to apply Record types, verify its exact contract, and adapt the example without bypassing validation or host boundaries.
Focused example
--!strict
type Color = "red" | "green" | "blue"
type GameState = {
interactions: number,
correctAnswers: number,
selectedColor: Color?,
cardRevealed: boolean,
}
local state: GameState = {
interactions = 0,
correctAnswers = 0,
selectedColor = nil,
cardRevealed = false,
}