← ClaudeAtlas

lua-guidelisted

Use when editing general-purpose Lua 5.4+: modules, scripts, configuration. Triggers on `.lua` files and prompts about module patterns, local scoping, metatables, coroutines, error handling, even when the user doesn't say 'Lua'.
xonovex/platform · ★ 5 · AI & Automation · score 72
Install: claude install-skill xonovex/platform
# Lua Coding Guidelines ## Requirements - Lua ≥ 5.4. ## Essentials - **Module pattern** - Always `local`, one module per file returning table, see [references/module-pattern.md](references/module-pattern.md), [references/local-variables.md](references/local-variables.md) - **Code organization** - Prefer table-based modules and simple functions, see [references/module-pattern.md](references/module-pattern.md), [references/metatables.md](references/metatables.md) - **Cooperative tasks** - Use coroutines for async patterns, see [references/coroutines.md](references/coroutines.md) - **Validation** - Validate inputs, see [references/input-validation.md](references/input-validation.md) - **Paradigm** - Functional style → **fp-guide**; class/OO design (metatable-based) → **oop-guide** ## Gotchas - Arrays are 1-indexed; a `nil` hole breaks the `#` length operator (it stops at the first nil) - Tables are both array and hash; mixing them is fine but iteration order isn't guaranteed for the hash part - `/` always returns a float; use `//` for integer floor division: `total // per_page`, not `math.floor(total / per_page)` - Variables are global by default unless declared `local`: forgetting `local` in a loop counter leaks into the surrounding scope ## Progressive disclosure - Read [references/module-pattern.md](references/module-pattern.md) - Load when creating reusable modules or organizing code structure - Read [references/local-variables.md](references/local-variables.md) - Lo