overview
the parity api is able to decompile lua 5.1-5.5 and luau bytecode back into readable source. currently, it's free (while in beta), with no accounts, and no api keys.
| base url | https://api.useparity.lol |
| max upload | 2 MB per request |
endpoints
POST /v1/decompile
decompiles one file. you can send the bytecode as the raw request body (Content-Type: application/octet-stream), or as base64 inside a json object when you want to set options:
| field | type | description |
|---|---|---|
script | string | the bytecode, raw or base64. gzip it first if you want, we decompress it. |
settings | object | any options from below, e.g. {"methodSyntax": false} |
accepts .luac .luauc .txt .bin inputs. returns 200 with your output.
GET /v1/health
returns 200 while the api is up.
options
options go in the settings object of the json body. you can omit a field to use its default.
| field | type | default | description |
|---|---|---|---|
inferNames | bool | true | names locals from how they're used (local Part = Instance.new("Part")) |
debugNames | bool | true | uses variable names stored in debug info when present |
identifierCase | enum | auto | casing for generated names: auto | pascalCase | camelCase | snake_case |
generatedNames | enum | descriptive | naming style when nothing better is known: descriptive | typed | simple |
inferTypes | bool | true | infers local types from the operations that use them |
inferRobloxTypes | bool | true | infers roblox types from calls like Instance.new |
typeAnnotations | bool | true | writes : type annotations where the type is known |
methodSyntax | bool | true | writes methods as function t:m() instead of t.m(self, ...) |
utf8 | bool | true | utf-8 text in strings instead of byte escapes |
headerInfo | bool | true | adds a comment header with the active settings, a parity watermark, and timings |
functionLineInfo | enum | functions | -- line: N markers on functions: off | functions | all |
functionDebugNames | bool | true | uses function names stored in debug info when present |
upvalueComments | bool | true | adds a comment listing the upvalues each function captures |
markInlinedCopies | bool | true | marks functions that were duplicated by inlining |
normalizeComparisons | bool | true | puts the variable on the left of comparisons (5 == x becomes x == 5) |
compoundAssignments | bool | true | x = x + 1 becomes x += 1 (luau) |
removeUselessForStep | bool | true | removes the step from numeric for loops when it's 1 |
mergeTableLiterals | bool | true | rejoins table constructors that were split into chunks |
parallelAssignments | bool | true | rebuilds a, b = x, y parallel assignments |
inlineTemporaries | bool | true | inlines single-use temporaries into the expression that reads them |
sugarLocalFunctions | bool | true | local f = function() becomes local function f() |
autoCleanup | enum | auto | dead code cleanup level: off | auto | aggressive |
removeUnusedLocals | bool | false | removes locals that are never read |
earlyReturns | bool | true | flattens nested ifs into guard clauses |
removeUselessReturn | bool | true | removes a trailing bare return |
interpolatedStrings | bool | true | rebuilds `{x}` string interpolations (luau) |
loopCompletionDefaults | bool | true | hides the extra flags loops use to track break/continue |
mathConstants | bool | true | writes known constants as math.pi, math.huge, etc. |
preferConst | bool | true | marks never-reassigned locals <const> (lua 5.4+) |
indentWidth | int | 4 | spaces per indent level, 0-16 |
rate limits
you will get 300 requests/minute with the api. going over 300 requests/min will return 429 with a Retry-After header. requests also run concurrently; if the concurrent job queue fills up you will get a 503, and will have to retry in usually around ~1 second.
errors
| status | condition |
|---|---|
| 400 | body isn't valid bytecode or the json is malformed |
| 413 | request over 2 MB |
| 429 | rate limited, see Retry-After? |
| 503 | job queue full, retry shortly |