Lua Formatter
Use StyLua to format Lua tables, functions, conditions and multiline strings locally. Choose the Lua version and indentation, then copy or download the result.
Format Lua and Keep a Multiline String
StyLua 2.6.0 runs on this device.
Lua Formatter: how to use it
- Paste a complete Lua file or load the example with a table and multiline string.
- Choose the Lua version used by your project and set tabs, two spaces or four spaces.
- Select Format Lua. Inspect the parsed output or follow the reported error, then copy or download the Lua file.
Limits and notes
Uses StyLua 2.6.0 with output syntax-tree verification for standard Lua 5.1, 5.2, 5.3 and 5.4. The browser worker accepts up to 125,000 characters and treats the program as source text.
How your privacy works →Lua Formatter: common questions
Which version should I select for bitwise operators?
Choose Lua 5.3 or 5.4 for native bitwise operators such as & and <<. Choose the version your project actually runs.
Do spaces inside a Lua long-bracket string count?
Yes. A long-bracket string can contain spaces and line breaks in its value. The worked example preserves two leading spaces on the second content line.
What does output verification check?
StyLua parses the formatted source and compares its syntax tree with the input. The application can still rely on behaviors outside syntax, so run your own project tests when adopting changes.