Hand-written or machine-generated Lua table files often have inconsistent indentation, spacing, and key-quoting. A `Format-Lua` function normalizes the text without changing semantics — equivalent to `ConvertFrom-Lua | ConvertTo-Lua` but expressed as a single ergonomic call. Sister modules already follow this pattern: [`Format-Json`](https://github.com/PSModule/Json) and [`Format-Hashtable`](https://github.com/PSModule/Hashtable). ## Request ### Desired capability ```powershell Get-Content settings.lua -Raw | Format-Lua Format-Lua -Path settings.lua -Indent 4 ``` ### Parameters | Parameter | Description | |-----------|-------------| | `-InputObject` | String to format (`ValueFromPipeline`, default set) | | `-Path` | File path to read and format | | `-LiteralPath` | Literal file path | | `-Indent` | Spaces per level (default: 2) | | `-Compress` | Single-line / minimal-whitespace output | ### Acceptance criteria - `Format-Lua $s` produces canonical-form Lua for `$s` - Idempotent: `Format-Lua (Format-Lua $s)` equals `Format-Lua $s` - `-Compress` produces a single-line representation - `-Indent` controls spacing between nesting levels - Output remains parseable by `ConvertFrom-Lua` --- ## Technical decisions **Implementation:** Parses input with `ConvertFrom-Lua` and re-emits with `ConvertTo-Lua` using the requested indentation. Reuses existing logic — no new parser or emitter. **Function placement:** `src/functions/public/Format-Lua.ps1`. **Parameter sets:** `InputObject` (default, pipeline) and `Path` / `LiteralPath` for file input. --- ## Implementation plan - [ ] Add `Format-Lua` in `src/functions/public/Format-Lua.ps1` - [ ] Add Pester tests — basic format, custom `-Indent`, `-Compress`, idempotent round-trip - [ ] Update README and `examples/General.ps1`