Syntax
local title = `Lesson {3}: Tables`Examples
Build a status label
Standalone Luau or a Script in ServerScriptService. Interpolation keeps the values beside their labels, while string.format gives explicit decimal formatting.
local completed = 3
local total = 8
print(`Completed {completed} of {total}`)
print(string.format("Progress: %.1f%%", completed / total * 100))Distinguish bytes from text
The accented letter occupies more than one UTF-8 byte. utf8.len counts code points, which still need not equal visible grapheme clusters for every string.
local word = "café"
print(#word) -- 5 bytes
print(utf8.len(word)) -- 4 code points
local labels = {"Types", "Tables", "Functions"}
print(table.concat(labels, " / "))Best practices
- Use table.concat for a list of fragments rather than repeatedly rebuilding a large string inside a loop.
- Do not split user-facing Unicode text at arbitrary byte positions.
- Treat player-entered text as untrusted; Roblox user-visible text can require platform filtering beyond string formatting.
Runtime & versions
Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
Luau documentation