← Luau typing quick reference

Annotations and inference

Luau 0.731 · --!strict
local name: Type · parameter: Type · function(): Type

A colon declares the expected type. Luau can infer obvious local values, while function and module boundaries benefit from explicit annotations.

When to use it

Read this page when you need to apply Annotations and inference, verify its exact contract, and adapt the example without bypassing validation or host boundaries.

Focused example

--!strict

local interactions: number = 0
local title: string = "Sixth Sense"

local function increment(value: number): number
    return value + 1
end

interactions = increment(interactions)
-- interactions = "one" -- luastra check reports a type error

Complete inventory

View all pages in Luau typing quick reference
Next: Arrays →