Lua Beautifier

Format common code, data, markup, and document languages locally in your browser.

How the Lua beautifier works

Lua blocks are delimited by keywords rather than braces, so the beautifier re-indents by counting function, do, then and repeat against end and until, treating else/elseif as a step back. Strings, comments and multi-line [[…]] strings are left untouched. if x then print(x) end written on three flush-left lines comes back with print(x) indented four spaces.