Keine Werbung mögen? Gehen Werbefrei Heute

Lua Code Formatter

EntwicklerText
ANZEIGE Entfernen?
ANZEIGE Entfernen?

Führung

Lua Code Formatter

Lua Code Formatter

Paste your Lua code and get a cleanly indented, evenly spaced version in one click. The formatter understands Lua block structure (if/then/end, do/end, function/end, repeat/until) and normalizes operator spacing without sending your code anywhere — everything runs in your browser, so it works for proprietary game scripts, embedded device firmware, and config snippets.

Nutzung

  1. Paste your Lua source into the input area, or click Probieren Sie ein Beispiel aus um ein Beispiel zu laden.
  2. Pick your indent style: 2 spaces (default), 4 spaces, or tabs.
  3. Umschalten Preserve comments if you want to strip both line and block comments instead of keeping them.
  4. Umschalten Zusammenfassen mehrerer leerer Zeilen to merge runs of empty lines into a single break.
  5. Klicken Sie auf Format. Use the copy or download icon to grab the result.

Funktionen

  • Block-aware indentation – Tracks Lua keywords (then, do, repeat, function, end, until, else, elseif) to produce consistent nesting.
  • Operatorabstand – Normalizes spacing around =, ==, ~=, .., arithmetic, and comparison operators while leaving table indexing (t.x) and method calls (obj:m()) tight.
  • String- und Kommentarsicherheit – Long strings ([[...]], [=[...]=]) and block comments are preserved verbatim; nothing inside them is reformatted.
  • Indent style choice – 2 spaces, 4 spaces, or tabs.
  • Comment control – Keep your comments or strip them all.
  • Blank-line cleanup – Optional collapse of long stretches of empty lines.
  • Privacy by default – 100% client-side, no upload, no AI round-trip.

Who It Is For

Lua shows up in game scripting (Roblox, Love2D, World of Warcraft addons, Garry’s Mod), embedded environments (OpenWrt, Redis modules, Neovim configs), and many CI pipelines. If you write or review Lua often, you want a fast, deterministic formatter that does not need a local toolchain. Drop in a snippet from a forum post, a co-worker’s pull request, or a generated config and clean it up instantly.

ANZEIGE Entfernen?

Häufig gestellte Fragen

  1. Why does Lua use end instead of curly braces?

    Lua was designed for embeddability and readability, so its authors chose keyword-delimited blocks (then/do/repeat ... end, until) over symbols. Keywords are easier to scan in short scripts and avoid clashes with host-language braces when Lua source is embedded in C strings. The trade-off is verbosity — every block must explicitly close, which is exactly why a formatter that gets the open/close pairing right is useful.

  2. What is the difference between short and long strings in Lua?

    Short strings are wrapped in single or double quotes and support escape sequences like \n and \t. Long strings use double square brackets ([[...]]) and an optional equals-sign level ([==[...]==]) so they can contain unescaped quotes and newlines. The bracket level lets you nest content that itself contains closing brackets — pick the smallest level that does not appear in your text.

  3. How does the .. concatenation operator differ from + in other languages?

    In Lua, + is strictly numeric — concatenating strings with + raises an error. The .. operator concatenates strings (auto-coercing numbers to their string form) and is right-associative, which means a..b..c is parsed as a..(b..c). For large concatenations, table.concat is faster because .. allocates a new string on every step.

  4. Why does Lua have both pairs and ipairs?

    ipairs iterates over the array part of a table — keys 1, 2, 3, ... until it hits nil. pairs iterates over every key, including string keys and any holes in the integer sequence. Iteration order with pairs is not guaranteed, while ipairs always proceeds in numeric order. Using the right one is both a correctness and a performance decision.

Möchten Sie werbefrei genießen? Werde noch heute werbefrei

Erweiterungen installieren

IO-Tools zu Ihrem Lieblingsbrowser hinzufügen für sofortigen Zugriff und schnellere Suche

Zu Chrome-Erweiterung Zu Kantenerweiterung Zu Firefox-Erweiterung Zu Opera-Erweiterung

Die Anzeigetafel ist eingetroffen!

Anzeigetafel ist eine unterhaltsame Möglichkeit, Ihre Spiele zu verfolgen. Alle Daten werden in Ihrem Browser gespeichert. Weitere Funktionen folgen in Kürze!

ANZEIGE Entfernen?
ANZEIGE Entfernen?
ANZEIGE Entfernen?

Nachrichtenecke mit technischen Highlights

Beteiligen Sie sich

Helfen Sie uns, weiterhin wertvolle kostenlose Tools bereitzustellen

Kauf mir einen Kaffee
ANZEIGE Entfernen?