API reference

Compatibility, conventions and a map of the libraries this reference covers.

Lynx adds a set of global functions and libraries to every script it runs. This reference covers the ones scripts use most: what they take, what they return, and an example you can paste into the editor.

Compatibility

Lynx implements the sUNC, UNC (Unified Naming Convention), Myriad and Synapse X function sets, so scripts written against them run unchanged. On the current build, 100% of the sUNC and 100% of the Myriad test suites pass.

sUNC
Coverage100%
Lynx's score on the sUNC test.
UNC
Coverage100%
The full unified naming convention.
Myriad
Coverage100%
Every test in the Myriad suite passes.
Synapse X
CoverageImplemented
Synapse X functions are available under their usual names.
Extras
CoverageBeyond both
Functions outside the standards, such as saveinstance and lz4compress.

Aliases from older executors, such as http_request, replaceclosure, toclipboard and getexecutorname, are available too. Each function lists its aliases.

Identifying Lynx

Scripts that support several executors can ask which one they're running on:

local name, version = identifyexecutor()
print(name) --> Lynx

The second value is the module's own build number, not the app version in the title bar.

Feature detection is usually the better check. It keeps working when a function is added somewhere else:

if typeof(hookmetamethod) ~= "function" then
warn("This script needs hookmetamethod.")
return
end

Conventions

Signatures

Signatures use Luau type syntax. function stands for any function, ...any for any number of values, and a ? marks an optional parameter or a value that may be nil. Functions marked Yields pause the calling thread until they finish.

Errors

Functions raise an error when an argument has the wrong type or an operation fails, such as a missing file or a closed WebSocket. Wrap calls in pcall when failure is expected:

local ok, contents = pcall(readfile, "maybe-missing.txt")
if not ok then
contents = ""
end

Thread identity

Code you execute runs at identity 8, above any game script. Functions that call back into your code, like hooks, connections and task.spawn, inherit it. See getthreadidentity.

Paths

File functions take paths relative to the workspace folder.

Libraries