Skip to the content.

Aurora API Reference

Auto-generated by adoc (tools/gen-apidocs.lua) — do not edit by hand.

These are the libraries intended for use from your own programs via require(...).


json

json.object(t)

json.encode(value, opts)

json.decode(s)


inspect

No public functions found.


class

No public functions found.


argparse

argparse:positional(name, desc)

argparse:flag(name, desc, opts)

argparse:option(name, desc, opts)

argparse:usage()

argparse:parse(...)

parse(…) — returns table of results or (nil, reason). Prints on help/error.

argparse:_err(msg)


ahttp

ahttp.request(method, url, opts)

request(method, url, opts) -> response | nil, err

ahttp.get(url, opts)

ahttp.post(url, body, opts)

ahttp.getJSON(url, opts)

getJSON(url) -> decoded, response | nil, err

ahttp.download(url, path, opts)

download(url, path, opts) -> true | nil, err
opts.sha256 (hex) verifies integrity; opts.onProgress(bytes) for UI.
Writes atomically: temp file, verify, then rename into place.


anet

anet.encode(message)

encode(message) -> wire string. Messages are JSON objects under a magic tag
so unrelated modem traffic on the same port is ignored.

anet.decode(wire)

decode(wire) -> message | nil (nil if not an anet frame / malformed)

anet.rpcRequest(method, params, id)

anet.rpcResult(id, result)

anet.rpcError(id, code, message)

anet.open(port)

anet.close(port)

anet.send(address, port, message)

anet.broadcast(port, message)

anet.recv(port, timeout)

recv(port, timeout) -> fromAddress, message | nil, “timeout”

anet.rpc.call(address, port, method, params, timeout)

call(addr, port, method, params, timeout) -> result | nil, err

anet.rpc.serve(port, handlers, opts)

serve(port, handlers, opts) — loop handling requests. opts.once stops after one.


aurora.util

util.trim(s)

util.split(s, sep, plain)

split(“a,b,,c”, “,”) -> {“a”,”b”,””,”c”}. If plain is false, sep is a pattern.

util.startsWith(s, prefix)

util.endsWith(s, suffix)

util.keys(t)

util.values(t)

util.map(t, fn)

util.filter(t, pred)

util.contains(t, value)

util.merge(a, b)

merge(a, b) -> new table with b’s keys overriding a’s (shallow).

util.humanBytes(n)

humanBytes(1536) -> “1.5K”


aurora.fsx

fsx.normalize(path)

fsx.join(...)

fsx.basename(path)

fsx.dirname(path)

fsx.ext(path)

fsx.readAll(path)

fsx.writeAll(path, data)

fsx.atomicWrite(path, data)

atomicWrite: write to .tmp-, fsync via close, then rename over the target. A crash mid-write never leaves a half-written destination file.

fsx.exists(path)

fsx.isDir(path)

fsx.mkdirs(path)

mkdirs: create a directory and all missing parents. Idempotent.

fsx.list(path)

fsx.ensureParent(path)

ensureParent: make sure the directory that will hold path exists.


aurora.hash

hash.sha256(data)

sha256(data) -> lowercase hex. Prefers the data card if available.

hash.sha256_pure(data)

always use the pure-Lua path (testing / determinism)

hash.crc32(data)


aurora.semver

semver.compare(a, b)

compare(a, b) -> -1 | 0 | 1

semver.eq(a, b)

semver.lt(a, b)

semver.gt(a, b)

semver.satisfies(version, constraint)

satisfies(version, constraint) -> boolean

semver.max(list)

max(list-of-version-strings) -> highest, or nil

semver.best(list, constraint)

best(list, constraint) -> highest version satisfying constraint


aurora.lua.parser

P:peek()

P:next()

P:err(msg, tok)

P:is(v)

is the current token op/keyword equal to v?

P:accept(v)

P:expect(v)

P:expectName()

P:primaryExpr()

P:args()

P:suffixedExpr()

P:tableConstructor()

P:functionBody(line)

P:simpleExpr()

P:subExpr(limit)

P:expr()

P:exprList()

P:block()

P:returnStat()

P:ifStat()

P:forStat()

P:funcStat()

P:localStat()

P:acceptAttrib()

Lua 5.4 / attributes — tolerated for forward compatibility.

P:exprStat()

P:statement()

parser.parse(src)


aurora.lua.gen

gen.exprList(list, ind)

gen.table(node, ind)

gen.format(src, opts)

format(src [, opts]) -> formatted source | nil, err

gen.fromAst(ast)


aurora.analyze

analyze.check(src)


aurora.doc

doc.extract(src)

extract(src) -> {items = { {name=, signature=, doc=, kind=, line=} , … }}

doc.markdown(src, opts)

markdown(src, opts) -> string | nil, err