lua
Lua development guidelines covering tables, metatables, error handling, game development, and performance optimization.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-04
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- lua
- metadata
- { "source": "https://github.com/Mindrally/skills", "maintainer": "Mindrally", "source_path": "lua/SKILL.md", "source_commit": "7682ca77710e0971eab4e0ae5dddfa281aea0ba5", "source_repository": "mindrally/skills" }
- description
- Lua development guidelines covering tables, metatables, error handling, game development, and performance optimization.
02 资源文件 4
- 参考文档agents/openai.yaml182 B
- 许可证LICENSE11.1 KB
- 参考文档references/upstream-skill.md2.5 KB
- 参考文档SOURCE.md430 B
03 SKILL.md 正文
Lua Development
You are an expert in Lua programming with deep knowledge of tables, metatables, and game development patterns.
Core Principles
- Write clear, concise Lua code that follows idiomatic patterns
- Leverage Lua's dynamic typing while maintaining code clarity
- Prioritize modularity and code reusability
- Focus on end-user experience across all code contributions
Lua-Specific Practices
- Maximize local variables for performance improvements
- Leverage tables effectively for data structures
- Implement error handling via pcall/xpcall functions
- Use metatables and metamethods appropriately
- Follow Lua's 1-based indexing consistently
Naming Conventions
- snake_case for variables and functions
- PascalCase for classes/modules
- UPPERCASE for constants
- Underscore prefix for private functions/variables
Code Organization
- Group related functions into modules
- Use local functions for module-private code
- Organize into logical sections with comments
- Keep files focused and manageable
- Utilize require() for dependencies
Error Handling
- Use pcall/xpcall for protected calls
- Handle nil values explicitly
- Use assert() for preconditions
- Provide informative error messages
- Implement proper error propagation
Performance Optimization
- Prefer local variables over global
- Cache frequently accessed values
- Minimize table creation in loops
- Pre-allocate tables when size is known
- Reuse tables when possible
- Use weak tables for caching when appropriate
Memory Management
- Be mindful of table creation in loops
- Reuse tables when possible
- Use weak tables for caching when appropriate
- Monitor memory usage in long-running applications
Metatables and OOP
- Use metatables for object-oriented patterns
- Implement __index for inheritance
- Use __newindex for property validation
- Leverage metamethods appropriately
Game Development
- Implement proper game loop structure
- Optimize collision detection efficiency
- Manage game state effectively
- Handle input processing efficiently
- Integrate properly with game engines (Love2D, Corona, etc.)
Testing and Documentation
- Write unit tests for critical functions
- Document function parameters and return values
- Include usage examples for public interfaces
04 同仓库更多 Skills
video-editing
Edit existing video footage with cuts, ordered segments, captions, overlays, audio cleanup, and reframing. Use for vlogs, demos, tutorials, and clips made from real recordings.
seedance-2-0-prompter
Design Seedance 2.0 video prompts from a creative brief and image, video, or audio references. Use for multimodal prompt construction and asset-role mapping before generation.
unreal-world-builder
Open-world and environment specialist - Masters UE5 World Partition, Landscape, procedural foliage, HLOD, and large-scale level streaming for seamless open-world experiences
unreal-technical-artist
Unreal Engine visual pipeline specialist - Masters the Material Editor, Niagara VFX, Procedural Content Generation, and the art-to-engine pipeline for UE5 projects
unreal-systems-engineer
Performance and hybrid architecture specialist - Masters C++/Blueprint continuum, Nanite geometry, Lumen GI, and Gameplay Ability System for AAA-grade Unreal Engine projects
unreal-multiplayer-architect
Unreal Engine networking specialist - Masters Actor replication, GameMode/GameState architecture, server-authoritative gameplay, network prediction, and dedicated server setup for UE5