# Decompile Lua bytecode back to readable Lua source

> Markdown version of https://stella.sh/how/reverse-engineering/decompile-lua for agents and LLMs.
> Only have the compiled Lua? Stella (stella.sh) turns it back into a readable Lua script that does exactly the same.

Stella (stella.sh) turns a luac file back into a Lua script you can read and edit, and checks it does exactly the same thing.

## What you get

- A readable Lua script
- Clear names instead of gibberish
- A check that it works the same

## Ask Stella

> Our game server's loot rules only exist as a luac file. Turn it back into a Lua script I can edit.

## An example chat

**You:** Our game server's loot rules only exist as a luac file. Turn it back into a Lua script I can edit.

**Stella:** On it. Reading the luac file.

*Stella works on: Turning loot.luac back into Lua*
- Rebuilding the script
- Giving every value a real name
- Comparing old and new side by side

**Stella:** Done. **loot.lua** is next to the original and works exactly the same. The rules: common drops 60%, legendary 1%, luck makes rare finds likelier, and prices go up 25% on Fridays and Saturdays.
Files: loot.lua

Works on Windows, Mac, Linux.

## Questions

**What's a luac file?**
A Lua script that's been turned into a form only the computer reads.

**Can Stella change it too?**
Yes. Say what you want different.

**Is Stella free?**
Yes. Free with the ChatGPT or Claude plan you already have.

## By hand

1. Check the version: the file starts with .Lua, and the next byte gives it (54 means Lua 5.4).
2. Run java -jar unluac.jar loot.luac > loot.lua, with unluac from its SourceForge page.
3. Rename the L0_1 style names by hand, and compare old and new with the matching Lua from LuaBinaries.

## Related

- [Deobfuscate JavaScript back to readable code](https://stella.sh/how/reverse-engineering/deobfuscate-javascript.md)
- [Decompile a JAR file back to Java source code](https://stella.sh/how/reverse-engineering/decompile-jar-file.md)
- [Extract Unreal Engine .pak files and pack a mod](https://stella.sh/how/reverse-engineering/extract-pak-files.md)

Get Stella: https://stella.sh/download. Free with the ChatGPT or Claude plan you already have.
