← Luau typing quick reference

Record types

Luau 0.731 · --!strict
type 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,
}

Complete inventory

View all pages in Luau typing quick reference
← Previous: Dictionaries and mapsNext: Enum-like singleton unions →