lua
1
总安装量
1
周安装量
#50031
全站排名
安装命令
npx skills add https://github.com/poletron/custom-rules --skill lua
Agent 安装分布
github-copilot
1
Skill 文档
Critical Patterns
Table Patterns (REQUIRED)
-- â
ALWAYS: Use tables for structured data
local user = {
name = "John",
age = 30,
greet = function(self)
print("Hello, " .. self.name)
end
}
user:greet() -- method call with self
Module Pattern (REQUIRED)
-- â
ALWAYS: Return table for modules
local M = {}
function M.process(data)
return data:upper()
end
return M
Error Handling (REQUIRED)
-- â
Use pcall for protected calls
local ok, result = pcall(function()
return risky_operation()
end)
if not ok then
print("Error: " .. result)
end
Decision Tree
Need class-like? â Use metatables
Need error handling? â Use pcall/xpcall
Need iteration? â Use pairs/ipairs
Need configuration? â Use external .lua files
Commands
lua script.lua # Run script
luac -o out.luac script.lua # Compile
luarocks install package # Install package
Resources
- Best Practices: best-practices.md
- Performance: performance.md
- Scripting: scripting.md