Skip to content

Lua API Overview

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

Lua API Overview

Beez scripts (build.lua) and Lua step callbacks have access to a global beez table. Use it to read configuration, touch the filesystem, fetch URLs, hash artifacts, and more — without shelling out for every task.

All file paths in the Lua API are relative to the project root (the directory that contains build.lua).


Modules at a glance

ModuleExampleWhat it does
beez.envbeez.env("TOKEN")Environment variables and .env
beez.configbeez.config({ cache = { ... } })Project settings
beez.fsbeez.fs.glob("src/**/*.cpp")Files and directories
beez.cryptobeez.crypto.hash_file("app.zip")Hashes and encodings
beez.sysbeez.sys.cpu_threads()Host information
beez.timebeez.time.now()Clock and sleep
beez.datebeez.date.format("%Y-%m-%d")Calendar formatting
beez.databeez.data.deserialize_file("cfg.json")JSON/YAML/XML/CSV/TOML
beez.netbeez.net.get(url, headers)HTTP and downloads
beez.archivebeez.archive.compress("dist", "out.zip")zip/tar archives
beez.textbeez.text.template("Hello {{name}}", vars)Strings and templates
Workersctx:spawn({ cmd = "make" })Background shell in a step

Developer reference (same content, in-repo): docs/lua-api-overview.md


Where APIs are available

Contextbeez.*ctx:spawn / wait
Top-level build.luayesno
step({ run = function(ctx) ... })yesyes

Error handling

  • Invalid arguments and I/O errors usually throw a Lua error.
  • beez.net.* REST helpers return { ok = false } for HTTP 4xx/5xx; network failures throw.
  • beez.data.validate throws when data does not match the schema.

Example build script

beez.config({
cache= { enabled=true },
})
localversion=beez.env("RELEASE_VERSION") or"dev"localartifacts=beez.fs.glob("dist/**/*")
step({
name="upload",
phase="publish",
scope="release",
run=function(ctx)
beez.archive.compress("dist", "bundle-" ..version..".zip")
localhash=beez.crypto.hash_file("bundle-" ..version..".zip", "sha256")
print("uploading", hash)
return0end,
})

See also

Clone this wiki locally