All projects
toolDevtool

Lua Obfuscator

A deterministic, CLI-first Lua obfuscation tool with project export and LÖVE2D-oriented defaults.

Role
Maintainer
Date
2026年6月
Status
Active experiment
Context
Fork of BillChirico/LUA-Obfuscator
Type
tool
Built with
TypeScript, Node.js, Lua, LÖVE2D
Readable Lua code passing through a noisy transformation and becoming compact obfuscated code.

Lua Obfuscator is a deterministic, TypeScript-based Lua obfuscation engine with a focused Node.js CLI and defaults made for LÖVE2D projects.

This is my fork of BillChirico/LUA-Obfuscator. I pushed this version toward a workflow where a complete LÖVE project can be prepared from the terminal, instead of only transforming one isolated piece of Lua.

What it does

The CLI can read one Lua file, receive source through standard input, or process a complete game directory. The result can be written to a file, printed to standard output for another tool to consume, or exported as a playable LÖVE folder.

Its transformations include identifier mangling, string and number encoding, control-flow obfuscation, minification, dead code and anti-debug helpers. A protection level controls how much of that work is applied, while individual transformations can also be enabled separately.

Made around LÖVE projects

The --love preset preserves the globals a LÖVE game expects. Project export copies the game into a new output folder, obfuscates its selected Lua files and leaves assets or excluded files alone.

A Lua configuration file can define which folders should be copied unchanged, limit which files are processed, and give individual files different settings. This matters for real games where vendor code, configuration files and public member names cannot all be treated in exactly the same way.

Repeatable output

The same source, options and seed produce the same result. That makes the obfuscator easier to use in builds and automated workflows because a release does not change randomly every time the command runs.

The tool also exposes the core engine as a Node API. The CLI and library use the same implementation, so it can be called directly from another build tool without having to shell out to a separate command.

What i learned from the fork

Obfuscating source is not only about replacing variable names. Lua still has to parse, the transformed program still has to behave the same way, and engine-owned globals need to remain available after every pass.

Working on this meant thinking about deterministic code generation, safe identifiers, preserved members, project-level configuration and testing the generated result inside an actual LÖVE game. The repository includes unit, integration and end-to-end tests, including an export test that runs an obfuscated LÖVE demo.

Obfuscation does not turn source code into perfect security, but it can make a shipped Lua project less immediate to read or modify. The useful part for me was making that step fit into the normal game build instead of being a manual process at the end.

The CLI, engine and test suite are available in the GitHub repository. The work is based on the original LUA-Obfuscator project.