lua-guide
Installation
SKILL.md
Lua Guide
Applies to: Lua 5.4+, LuaJIT 2.1, Neovim Plugins, Love2D, Embedded Scripting
Core Principles
- Tables Are Everything: Arrays, maps, objects, modules, and namespaces -- master them
- Local by Default: Always declare variables
local; globals are a performance and correctness hazard - Explicit Error Handling: Use
pcall/xpcallfor recoverable errors;error()for programmer mistakes - Minimal Metatables: Use metatables for genuine OOP needs, not as decoration on simple data
- Embed-Friendly Design: Lua exists to be embedded; keep the host/script boundary clean and narrow
Guardrails
Code Style
- Use
localfor every variable and function unless it must be global - Naming:
snake_casefor variables/functions,PascalCasefor class-like tables,UPPER_SNAKE_CASEfor constants - Indent with 2 spaces; one statement per line; avoid semicolons
Related skills