Skip to content

Lua API Text

Leonard Ramminger edited this page Aug 10, 2026 · 1 revision

Lua API — Text (beez.text)

String helpers, ECMAScript regex, Prebyte templates, and line diffs.

Predicates and transforms

FunctionDescription
contains, starts_with, ends_withboolean checks
to_lowercase, to_uppercase, to_casecase changes
replace, replace_allsubstring replace
split, join, trimsplit/join/trim

Regex

beez.text.regex_match("abc123", "^abc\\d+$")
beez.text.regex_replace("foo bar foo", "foo", "baz")

Uses C++ std::regex (ECMAScript). In Lua strings, write \\d for \d.

Templates

beez.text.template("Hello {{ name }}", { name="Beez" })
beez.text.template("{{ if ready }}yes{{ else }}no{{ endif }}", { ready=true })
-- Lua arrays use 1-based indexing in templatesbeez.text.template("{{ items[1] }}", { items= { "a", "b" } }) -- "a"

Line diff

localchunks=beez.text.diff(old_text, new_text)
-- { { op = "equal"|"insert"|"delete", text = "..." }, ... }

For table diffs use beez.data.diff.


← Lua API Overview

Clone this wiki locally