Format and indent Lua source code.
The Lua Beautifier re-indents Lua source code according to its block structure. Choose 2 spaces, 4 spaces or tabs, paste or open a .lua file, and press Beautify Lua. It is meant for developers cleaning up scripts for games, game mods, embedded configs and plugins.
Lua is a lightweight, embeddable scripting language created at PUC-Rio in Brazil in 1993. It is widely used for game scripting, configuration, and extending applications such as Neovim, Redis and many game engines. Blocks in Lua are closed with keywords rather than braces: function, if, do and repeat open blocks, while end or until closes them. Tables written with curly braces are the main data structure. Because indentation carries no meaning in Lua, it is purely a readability choice, so a formatter can safely rewrite leading whitespace as long as the block structure is understood.
No. It never executes code. It only scans for block keywords and quotes, and it reports unbalanced blocks or unterminated strings, but it is not a full syntax or type checker.
2 spaces, 4 spaces or Tab. The default is 2 spaces.
Lines inside long strings and long comments, such as [[ ... ]] and --[[ ... ]], are kept exactly as written so their content is not altered.
No. Only the leading whitespace of each line is changed and runs of blank lines are kept as empty lines. The output ends with a single newline.
They open with do, which is a tracked block keyword, and close with end, so their bodies are indented correctly.