Lua base library
Matcha runs on a Luau-based VM, so the standard Lua(U) global functions are available and behave per the Lua 5.1 reference except where noted below. This page lists what the VM actually exposes and flags the Matcha-specific differences — it does not re-document standard Lua semantics.
Standard library surface
The following members are exposed in Matcha 1.0.0. Exposure confirms lookup only unless a section elsewhere in this reference describes verified behavior.
math
math.abs math.acos math.asin math.atan
math.atan2 math.ceil math.clamp math.cos
math.cosh math.deg math.exp math.floor
math.fmod math.frexp math.huge math.ldexp
math.log math.log10 math.max math.min
math.modf math.noise math.pi math.pow
math.rad math.random math.randomseed
math.round math.sign math.sin math.sinh
math.sqrt math.tan math.tanhstring
string.byte string.char string.find string.format
string.gmatch string.gsub string.len string.lower
string.match string.pack string.packsize string.rep
string.reverse string.split string.sub string.unpack
string.upperstring.pack, string.packsize, string.split, and string.unpack are available Luau additions.
table
table.clear table.clone table.concat table.create
table.find table.foreach table.foreachi table.freeze
table.getn table.insert table.isfrozen table.maxn
table.move table.pack table.remove table.sort
table.unpackcoroutine
coroutine.close coroutine.create coroutine.isyieldable
coroutine.resume coroutine.running coroutine.status
coroutine.wrap coroutine.yieldutf8
utf8.char utf8.charpattern utf8.codepoint
utf8.codes utf8.len utf8.offsetbit32
bit32.arshift bit32.band bit32.bnot bit32.bor
bit32.btest bit32.bxor bit32.countlz bit32.countrz
bit32.extract bit32.lrotate bit32.lshift bit32.replace
bit32.rrotate bit32.rshiftThe bit32 library is available even when bitwise operator syntax is not desired.
buffer
buffer.copy buffer.create buffer.fill buffer.fromstring
buffer.len buffer.readf32 buffer.readf64 buffer.readi8
buffer.readi16 buffer.readi32 buffer.readstring buffer.readu8
buffer.readu16 buffer.readu32 buffer.tostring buffer.writef32
buffer.writef64 buffer.writei8 buffer.writei16 buffer.writei32
buffer.writestring buffer.writeu8 buffer.writeu16 buffer.writeu32The audit confirmed that these buffer functions exist but did not invoke every function. Do not infer untested edge-case behavior from exposure alone.
vector
vector vector.abs vector.angle vector.ceil
vector.clamp vector.create vector.cross vector.dot
vector.floor vector.magnitude vector.max vector.min
vector.normalize vector.signThe vector library and these functions are exposed; their full semantics were not exercised by the safe audit.
os and debug
os.clock os.date os.difftime os.time
debug.info debug.tracebackThese functions are exposed. The safe audit did not invoke them.
Type & conversion
type
function type(value: any): stringStandard. Roblox datatypes (Vector3, CFrame, …) and Instances all report as "userdata" — use typeof for the specific name.
tostring
function tostring(value: any): stringStandard, and honors __tostring. Matcha formats Roblox datatypes differently from Roblox itself — tostring(Vector3.new(1, 2, 3)) returns "Vector3(1.0000, 2.0000, 3.0000)", not "1, 2, 3".
tonumber
function tonumber(value: any, base: number?): number?Standard. Trims surrounding whitespace, parses 0x hex, and accepts a base (2–36) — tonumber("ff", 16) returns 255. Returns nil if the value can't be parsed.
Iteration & varargs
pairs / ipairs / next
function pairs(t: table): (function, table, any)
function ipairs(t: table): (function, table, number)
function next(t: table, key: any?): (any, any)Standard iteration; ipairs stops at the first nil hole.
pairsdoes not honor the Luau__itermetamethod — it always iterates the raw table.
select
function select(n: number | "#", ...): ...Standard, including negative indices: select(-1, ...) returns the last argument.
unpack
function unpack(t: table, i: number?, j: number?): ...Returns t[i] through t[j] (defaults i = 1, j = #t). Exposed as a global — mainline Luau only provides table.unpack. unpack and table.unpack are separate function objects but behave identically.
Errors & protected calls
assert
function assert(value: any, message: string?, ...): ...Raises a catchable error (Matcha:<line>: <message>, or assertion failed! with no message) if value is falsy; otherwise returns its arguments unchanged — the way to raise a catchable error in Matcha.
pcall
function pcall(f: function, ...): (boolean, ...)Standard. Returns true plus f's results on success, or false, "Matcha:<line>: <message>" on a runtime fault.
xpcall
function xpcall(f: function, handler: function, ...): (boolean, ...)Standard, and forwards extra arguments to f (Luau-style): xpcall(fn, handler, 3, 4) calls fn(3, 4). On a real error, handler runs with the error message.
Metatables
setmetatable / getmetatable
function setmetatable(t: table, mt: table?): table
function getmetatable(t: any): table | anyStandard. getmetatable returns the __metatable field when set; setmetatable on a table with a protected (__metatable) metatable raises cannot change a protected metatable.
newproxy
function newproxy(addMetatable: boolean?): userdataLua 5.1 holdover, fully supported. Returns a blank userdata; with newproxy(true) it gets a fresh, settable metatable (retrieved via getmetatable), so metamethods like __index and __tostring work.
Raw access
rawget / rawset / rawequal / rawlen
function rawget(t: table, key: any): any
function rawset(t: table, key: any, value: any): table
function rawequal(a: any, b: any): boolean
function rawlen(t: table | string): numberStandard. These bypass metamethods; rawset returns the table.
Memory
gcinfo
function gcinfo(): numberReturns the VM's current memory usage in kilobytes.