Standard Built-in Luau Libraries
These are the libraries that ship inside the Luau VM itself, available to every script. AntOS compiles its VM from the current official Luau repository, so this surface tracks upstream Luau. The library is deliberately minimal — it manipulates Luau's built-in data types and little else. Anything that touches storage, the terminal, the network, or the hardware comes from the AntOS libraries, not from here.
Back to the Luau scripting hub. For the language itself, see the Luau language.
What "standard library" means in Luau
Luau's own description is worth keeping in mind: the standard library is intentionally small and does not expose ways for scripts to interact with the host environment — that's the embedder's job. On AntOS the embedder is the OS, which adds its own libraries on top. So the libraries below are pure computation and data manipulation: numbers, tables, strings, coroutines, bit twiddling, UTF-8, time, raw memory buffers, and vectors. They are always available without require.
Global functions
A handful of functions live in the global namespace rather than in a library table. The ones you'll use most:
assert(value, message?)— errors ifvalueis falsy; otherwise returns it.error(obj, level?)— raises an error (the object need not be a string;pcallpreserves its type).levelattributes the error to a caller.pcall(f, ...)/xpcall(f, handler, ...)— protected calls; returntrue, results...on success orfalse, erron failure. Both can yield.pairs(t)/ipairs(t)— iterators; though Luau's generalized iteration often makes them unnecessary.next(t, key?)— manual table traversal step.select(i, ...)— count or slice varargs (select("#", ...)counts).tonumber(s, base?)/tostring(obj)— conversions;tostringhonours__tostring.type(obj)— returns"nil","boolean","number","vector","string","table","function","userdata","thread", or"buffer". Notevectorandbufferare first-class Luau types.typeof(obj)— liketype, but returns the host-defined type for tagged userdata.rawget/rawset/rawequal/rawlen— table/string operations that bypass metatables.setmetatable(t, mt)/getmetatable(obj)— metatable access.unpack(a, f?, t?)— equivalent totable.unpack.print(...)— writes arguments to standard output, Tab-separated (calls__tostring).getfenv/setfenv/newproxy— present for compatibility; avoid in new code (see the language page).
math library
The numeric workhorse. Standard trigonometry and exponentials (sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, exp, log, log10, pow, sqrt), rounding (floor, ceil, abs, fmod, modf), angle conversion (rad, deg), and float decomposition (frexp, ldexp).
Random numbers use a PCG generator: math.random() returns [0,1), math.random(n) returns [1,n], math.random(min,max) returns [min,max]; math.randomseed(seed) makes the sequence deterministic.
Luau additions worth knowing (not in stock Lua 5.1):
math.clamp(n, min, max)— constrain to a range (errors ifmin > max).math.sign(n)—-1,0, or1.math.round(n)— nearest integer, ties away from zero.math.lerp(a, b, t)— linear interpolation; returns exactlybwhent == 1.math.map(x, inmin, inmax, outmin, outmax)— linear range remap.math.noise(x, y?, z?)— 3D Perlin noise in[-1, 1].
math.huge and math.pi are the usual constants.
table library
Array and dictionary manipulation:
table.insert(t, v)/table.insert(t, i, v)— append or insert-at-index.table.remove(t, i?)— remove (and return) an element, default last.table.concat(t, sep?, f?, t?)— join string elements; the idiomatic way to build a large string instead of repeated...table.sort(t, cmp?)— in-place sort with optional comparator (must be a strict weak ordering).table.pack(...)/table.unpack(t, f?, t?)— varargs to/from a table;packsetsn. Unpacking packed varargs needs the explicit range:table.unpack(args, 1, args.n).table.move(a, f, t, d, tt?)— bulk-copy a range between (or within) tables.table.maxn(t)— largest numeric key.
The deprecated table.foreach, table.foreachi, and table.getn still exist for compatibility but should not be used — prefer for loops and #t.
Several fast Luau-specific helpers (such as table.create, table.find, table.clear, table.clone, table.freeze/table.isfrozen) are part of Luau's table library in the official VM; treat the official Standard Library reference as the authoritative list for the exact build, since this surface grows over time.
string library
Full pattern matching and formatting: string.find, string.match, string.gmatch, string.gsub, string.format, string.sub, string.rep, string.len, string.lower, string.upper, string.byte, string.char, string.reverse. Luau patterns include the 5.2 additions (frontier patterns, %g, \0 in patterns).
Binary packing from Lua 5.3 is present: string.pack, string.unpack, string.packsize — useful for reading and writing structured binary data. string.split (split a string on a separator into a table) is a Luau convenience. Note that string.dump is not available (bytecode exposure is a sandboxing hazard).
Strings also respond to method syntax via the string metatable, so ("hello"):upper() works.
coroutine library
Cooperative multitasking within a script: coroutine.create, coroutine.resume, coroutine.yield, coroutine.wrap, coroutine.status, coroutine.running, coroutine.isyieldable, and coroutine.close (the Lua 5.4 addition for cleanly tearing down a suspended coroutine). pcall/xpcall are yieldable in Luau, so you can yield across a protected call.
bit32 library
Because Luau has a single number type and no bitwise operators (see the language page), bit32 is how you do bit manipulation — on 32-bit values:
bit32.band, bit32.bor, bit32.bxor, bit32.bnot, bit32.lshift, bit32.rshift, bit32.arshift (arithmetic shift), bit32.lrotate, bit32.rrotate, bit32.extract, bit32.replace, bit32.btest, bit32.countlz/bit32.countrz (count leading/trailing zeros). These compile to VM builtins, so they're fast — much faster than the equivalent in plain Lua.
utf8 library
Proper UTF-8 handling: utf8.char, utf8.codepoint, utf8.len, utf8.offset, utf8.codes (iterator), and the utf8.charpattern pattern. Decoding functions reject surrogate code points, matching Lua 5.4 behaviour. This is the right tool for any text that isn't pure ASCII.
os library
The standard os library in Luau is a small, sandboxed subset — time and clock functions only, none of the process/file functions that stock Lua's os carries (os.execute, os.remove, os.exit, etc. are not part of standard sandboxed Luau):
os.time(t?)— Unix timestamp; with a table argument it returns a UTC timestamp (a deliberate Luau consistency choice).os.clock()— high-resolution process time, for measuring durations.os.date(fmt?, t?)— format a timestamp into a string or table.os.difftime(a, b)— difference between two timestamps.
Important: AntOS provides its own extended
oslibrary on top of this — system reset, uptime, and other host operations — documented in antos_os (design) and luau_os (the API). When a script calls anosfunction that isn't in the list above, it is using the AntOS extension, not standard Luau.
buffer library
Luau has a first-class buffer type: a fixed-size, mutable block of raw memory, with all operations provided by the buffer library. This is the efficient way to handle binary data — file contents, network packets, structured records — without the overhead of strings or tables.
Core operations: buffer.create(size), buffer.fromstring/buffer.tostring, buffer.len, buffer.copy, buffer.fill, and typed read/write at a byte offset — buffer.readu8/readi8/readu16/readi16/readu32/readi32/readf32/readf64 and the matching write* functions. Offsets are byte offsets from the start of the buffer. For binary-heavy AntOS work (streaming I/O, asset parsing) buffers are usually the right representation.
vector library
Luau has a native vector type (so type(v) can return "vector"), with a vector library for construction and maths. Because vectors are a built-in value type with fast-call support, vector arithmetic is cheap — useful for coordinates, colours, and any small fixed-width numeric tuple. Treat the official Standard Library reference as authoritative for the exact constructor and function set in the current build, as the vector library is an area of active upstream development.
debug library
A reduced, sandbox-safe subset compared to stock Lua's debug — primarily debug.traceback (a human-readable call stack, format subject to change) and debug.info. The introspective and mutating functions from standard Lua's debug that would break the sandbox are not present.
What's deliberately not here
Standard Luau omits, by design:
io— no standard file I/O library at all. AntOS supplies its own. See AntOS libraries.package/requireof arbitrary filesystem modules — module loading is host-controlled.loadfile,dofile— no direct file access.- bytecode loading (
loadstringof bytecode,string.dump) — sandboxing hazard. - the host-touching parts of
osanddebug— replaced or removed.
This is not a limitation to work around — it's the contract that lets AntOS hand the system to scripts safely. The capabilities those libraries would have provided are supplied instead by the OS, shaped to DBFS, the terminal, and the hardware. That's the subject of the next page.
Where to go next
- The libraries AntOS adds (storage, terminal, network, hardware) → AntOS libraries
- How the language itself differs from Lua → The Luau language
- Back to the Luau scripting hub
For the exact, version-precise function list of any built-in library, the official Luau Standard Library reference is authoritative — this page describes the same surface in AntOS terms but the upstream library evolves.