1
2
Fork
You've already forked rbxtsc-decompiler
0
A decompiler for Roblox TS / rbxtsc.
  • Rust 100%
2025年06月02日 22:13:18 -05:00
.idea chore: stuff before I try to do another rewrite 2025年03月17日 19:36:08 -05:00
.vscode draft: add some transformers 2025年06月02日 22:13:18 -05:00
src draft: add some transformers 2025年06月02日 22:13:18 -05:00
.gitignore ignore: input.luau 2024年11月16日 19:59:13 -06:00
Cargo.toml deps: update 2025年06月02日 16:58:25 -05:00
LICENSE.md chore: add license 2024年11月09日 12:47:07 -06:00
ReadME.md chore(ReadME.md): fix spelling 2025年03月15日 18:36:15 -05:00
REWRITE.md chore: stuff before I try to do another rewrite 2025年03月17日 19:36:08 -05:00
rustfmt.toml chore: add rustfmt.toml 2024年11月09日 12:41:13 -06:00

rbxts-decompiler

Important

Things like types or etc. can't be supported, as Roblox TS doesn't emit anything that will let us know what the TypeScript type for something is. This probably won't be implemented in Roblox TS anyway, so just remember, you won't get 1:1 results. Also, decompiler (with optimizations enabled) support isn't very good. The reason why is that things like do loops get inlined by the compiler (even without optimizations), repeat until true loops get inlined by the compiler (on optimization 1+), etc. We might make a script for fixing problems caused by optimizations later, but for now, if you're using a decompiler (decompiling scripts compiled with optimizations), don't expect it to transform all the supported syntax.

A decompiler for Luau files that are compiled from TypeScript using Roblox TS.

Progress / TODOs

See https://github.com/roblox-ts/roblox-ts/tree/master/src/TSTransformer for all transformers: [Statements]: https://github.com/roblox-ts/roblox-ts/tree/master/src/TSTransformer/nodes/statements [Expressions]: https://github.com/roblox-ts/roblox-ts/tree/master/src/TSTransformer/nodes/expressions

  • Enums
  • Classes
  • Functions
  • For Loops
    • Numeric For Loops
      • partially, code like: for (let i = 0; i >= 5; i++) {
      • or for (let i = 0; i === 5; i++) { won't be transformed
    • For-Of Loops (should be easy)

Usage

# cargo 1.82.0 (8f40fc59f 2024年08月21日) or earlier
cargo run -- <file_path>
# or:
cargo run <file_path>

Example

cargo run input.luau

Input:

-- Compiled with roblox-ts v3.0.0
local exampleEnum
do
 local _inverse = {}
 exampleEnum = setmetatable({}, {
 __index = _inverse,
 })
 exampleEnum.A = 0
 _inverse[0] = "A"
 exampleEnum.B = 1
 _inverse[1] = "B"
 exampleEnum.C = 2
 _inverse[2] = "C"
 exampleEnum.D = 3
 _inverse[3] = "D"
 exampleEnum.magic = 420
 _inverse[420] = "magic"
end
return nil

Output:

enum exampleEnum {
 A = 0,
 B = 1,
 C = 2,
 D = 3,
 magic = 420
}

License

AGPL v3.0