Skip to content

Strings

String represents valid UTF-8 text. Write a string literal between double quotation marks:

local language = "Pop"
local greeting = "Olá, mundo!"
local symbol = "🫧"

Non-ASCII text is preserved. The compiler and runtime do not replace valid Unicode text with a byte-oriented approximation.

Quoted strings accept portable escapes such as \\, \", \n, \r, \t, \0, \x41, and \u{1FAE7}:

local twoLines = "first\nsecond"
local quoted = "say \"Pop\""
local bubble = "\u{1FAE7}"

The Luau-shaped .. operator joins two strings:

local directory = "src"
local path = directory .. "/main.pop"

The numeric + operator intentionally does not concatenate strings. Convert a primitive explicitly before joining it:

local count = 3
local message = "count=" .. String(count)

String(value) formats String, Boolean, and every integer or floating-point primitive. It is not a universal toString operation and rejects arrays, tables, records, classes, and functions.

Backticks interpolate the same closed primitive set. Expressions inside braces are evaluated from left to right:

local count = 3
local enabled = true
local summary = `count={count}, enabled={enabled}`

Use \{, \}, and \`` for literal interpolation punctuation inside backticks. ${value}` is not Pop syntax.

== compares string contents, and ~= tests that the contents differ:

local expected = "Pop"
local actual = "Pop"
local same = expected == actual -- true

The comparison is by UTF-8 value, not by the identity of the managed string objects.

The Standard foundation provides print(String), which writes the string followed by a newline:

print("one line")
print("another line")

Alongside print(Int), this is the basic output overload surface in rc.6. The Standard library now exposes typed text operations through Pop.Text, including search, slicing, trimming, replacement, splitting, joining, and integer parsing; Pop.Unicode exposes predicates over Rune.

String composition may allocate managed storage. Formatting is deterministic and locale-independent: booleans use true/false, integers use base ten, and floating-point values use portable spellings including nan, inf, and -inf.

The String composition and formatting leaf collects the practical choice between .., backticks, and String(value).