Skip to content
Back to skills

Lua Engineering

ASecurity

Design, implement, embed, debug, test, profile and deploy Lua applications and scripting APIs. Use for PUC Lua 5.1 through 5.5, LuaJIT and Luau distinctions; language semantics, tables and metatables, modules and hot reload, coroutines and errors, C/C++ embedding and native modules, garbage collection and performance, LuaRocks and tooling, sandboxing, persistence, networking, portable libraries, and simulation or event-driven game rules. Keep Unreal-specific integration in unreal-lua-engineer...

  • 4 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 28, 2026
ai-agentspythonrustc++testingdebugginggitapisecurityperformance

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned November 28, 2026

npx -y skills add Getty/skills --skill lua-engineering --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Lua Engineering?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Lua Engineering
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/getty-lua-engineering/badge)](https://www.skillsdirectory.com/skills/getty-lua-engineering)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: lua-engineering
description: Design, implement, embed, debug, test, profile and deploy Lua applications and scripting APIs. Use for PUC Lua 5.1 through 5.5, LuaJIT and Luau distinctions; language semantics, tables and metatables, modules and hot reload, coroutines and errors, C/C++ embedding and native modules, garbage collection and performance, LuaRocks and tooling, sandboxing, persistence, networking, portable libraries, and simulation or event-driven game rules. Keep Unreal-specific integration in unreal-lua-engineering.
---

# Lua Engineering

Build against the actual runtime and host contract. Use this skill as a routed engineering knowledge base; load only the references required by the task. Keep a small script small. Do not impose an application framework, sandbox, coroutine scheduler or native extension when the task does not need one.

## Establish the runtime contract

1. Inspect the repository, host, build configuration and existing conventions.
2. Identify implementation (PUC Lua, LuaJIT, Luau or host fork), exact version/build, platform, numeric configuration, enabled libraries and native dependencies.
3. Distinguish CLI, embedded trusted rules, untrusted plugins, event-loop application and engine-hosted scripts. A host may remove standard functions or replace their behavior.
4. Record ownership of mutable state, scheduling/thread access, error propagation, persistent data, resource lifetime and deployment format where relevant.
5. Prefer the project's runtime. For a new unconstrained application, evaluate the current PUC release and required library/tool support. Do not silently migrate an embedded runtime.
6. Inspect or run a bounded probe for missing decisive details. State assumptions and continue with useful work before asking for information.

Evidence snapshot: 2026-11-22. Lua 5.5 is current in this snapshot; Lua 5.4 remains an important deployed embedding target. Refresh patch levels, bug reports and tool syntax support before dependency selection. Read [versions](references/versions-and-portability.md) and [source policy](references/sources-and-evidence.md).

## Route to the relevant material

| Task or failure | Reference |
|---|---|
| Choose a runtime, support several versions or migrate | [Versions and portability](references/versions-and-portability.md) |
| Check truthiness, scope, multiple returns or iteration | [Language semantics](references/language-semantics.md) |
| Represent arrays, maps, sparse values, IDs or graphs | [Tables and data models](references/tables-and-data-models.md) |
| Implement methods, inheritance, proxies or weak tables | [Metatables and object models](references/metatables-and-object-models.md) |
| Load modules, control environments or replace code | [Modules, environments and reload](references/modules-environments-and-reload.md) |
| Handle errors, cleanup, cancellation and coroutines | [Errors, resources and coroutines](references/errors-resources-and-coroutines.md) |
| Parse text, UTF-8, patterns or binary protocols | [Strings, patterns and binary data](references/strings-patterns-and-binary-data.md) |
| Adopt global declarations, named varargs or 5.5 APIs | [Lua 5.5 changes](references/lua55-changes.md) |
| Organize modules, interfaces, configuration and lifecycle | [Application architecture](references/application-architecture.md) |
| Save/load state, exchange JSON or migrate schemas | [Persistence and data exchange](references/persistence-and-data-exchange.md) |
| Handle time, randomness and numerical accuracy | [Numbers, time and randomness](references/numbers-time-and-randomness.md) |
| Use files, sockets, HTTP or host-specific APIs | [I/O, networking and hosts](references/io-networking-and-hosts.md) |
| Embed Lua and maintain stack/registry contracts | [Embedding and the C API](references/embedding-c-api.md) |
| Manage native handles, callbacks, threads and teardown | [Native lifetime and async](references/native-lifetime-and-async.md) |
| Expose capabilities to untrusted code | [Sandboxing and capabilities](references/sandboxing-and-capabilities.md) |
| Measure allocations, GC, boundary cost and throughput | [Performance and GC](references/performance-and-gc.md) |
| Use LuaJIT, FFI, Luau typing or codegen | [LuaJIT and Luau](references/luajit-and-luau.md) |
| Configure LuaLS, linting, formatting, packages and types | [Tooling and dependencies](references/tooling-and-dependencies.md) |
| Debug a failure or build a meaningful test matrix | [Testing and debugging](references/testing-and-debugging.md) |
| Build native modules or deploy across platforms | [Deployment and native modules](references/deployment-and-native-modules.md) |
| Implement simulation, rules, commands or replay | [Simulation and event systems](references/simulation-and-event-systems.md) |
| Find manuals, source, errata and validation provenance | [Sources and evidence](references/sources-and-evidence.md) |

## Preserve correctness conditions

- Keep syntax, library behavior and C ABI specific to the runtime. LuaJIT is not PUC Lua 5.4; Luau is a distinct dialect/runtime.
- Treat only nil and false as false. Preserve legitimate false or zero when applying defaults.
- Define dense sequence, sparse map or record semantics. Do not use table length as arbitrary key count or assign semantic order to unspecified traversal.
- Preserve argument/result counts when nil matters. Check expansion in tail positions.
- Separate module state from session/world/request state. Require caching, callbacks and captured closures affect reload.
- Make mutation ownership explicit. Coroutines do not provide parallel VM access, an OS scheduler or nonblocking I/O.
- Protect native boundaries, maintain stack balance, retain registry references deliberately and release them before VM destruction. Avoid unsafe longjmp across C++ object lifetimes.
- Serialize data through a defined schema. Source code, bytecode, closures and native addresses are not a portable persistence model.
- For hostile scripts, audit reachable capabilities, loaders, native libraries, budgets and isolation. An environment table alone is not a complete security boundary.
- Profile the real workload. Do not infer latency, memory or entity capacity from a language name or unrelated microbenchmark.

Read the matching references for version-specific evidence and exceptions. Apply only mechanisms relevant to the task.

## Implement and verify

1. Define or reproduce the observable requirement with explicit host assumptions.
2. Choose the smallest data model and lifecycle that satisfies it.
3. Implement a pure core or small module boundary where useful; inject the capabilities actually required.
4. Define error, empty/nil, invalid-input and resource-release behavior.
5. Check with the target parser/runtime. Tooling that rejects new syntax is not proof of a language error.
6. Verify success and meaningful failure/boundary cases. Test multiple runtimes only when portability is a requirement.
7. Profile relevant costs and optimize measured limiting work.
8. Report changes, actual runtime/toolchain, results and unresolved limits.

For conceptual requests, give the design and examples. For implementation requests, continue through working code and verification. A standalone Lua test does not certify an engine or native integration.

## Use the bundled diagnostics

Run from this skill directory with an explicit interpreter:

~~~sh
/path/to/lua scripts/runtime_probe.lua
/path/to/lua scripts/semantic_checks.lua
python3 scripts/run_lua_checks.py --lua /path/to/lua
~~~

Repeat --lua to compare supported PUC/LuaJIT executables. The Python runner uses argument arrays and a bounded timeout; it installs nothing, downloads nothing and executes no project files. Probes execute bundled trusted diagnostic chunks. Results are observations, not a complete conformance or sandbox certificate. Luau/restricted hosts need their own launch adapters.

- [Runtime contract](assets/runtime-contract.json): optional decision record.
- [Rules example](assets/rules.lua): explicit state and no mutation on rejected input; tested by semantic_checks.lua.
- [Minimal C host](assets/minimal_host.c): PUC 5.4/5.5 embedding example for trusted scripts, deliberately exposing standard libraries. Read the embedding reference for build and limits.

## Keep host boundaries clear

Lua can implement substantial domain logic. Place bulk operations, engine lifecycle, OS services and authority checks at an appropriate host boundary. Preserve the option to optimize selected systems without scattering host details through every rule.

For Unreal, use unreal-lua-engineering for engine versions, UObjects, worlds, replication, packaging and build evidence. Do not make this general Lua skill depend on a game engine, package manager or editor.

Files in this skill

  • SKILL.md8.6 KB
  • agents/openai.yaml379 B
  • assets/icon.svg1.7 KB
  • assets/minimal_host.c3.5 KB
  • assets/rules.lua2.2 KB
  • assets/runtime-contract.json842 B
  • references/application-architecture.md6.2 KB
  • references/deployment-and-native-modules.md11.1 KB
  • references/embedding-c-api.md12.4 KB
  • references/errors-resources-and-coroutines.md8.8 KB
  • references/io-networking-and-hosts.md6 KB
  • references/language-semantics.md6.7 KB
  • references/lua55-changes.md10.1 KB
  • references/luajit-and-luau.md10 KB
  • references/metatables-and-object-models.md6.5 KB
  • references/modules-environments-and-reload.md7.6 KB
  • references/native-lifetime-and-async.md11.5 KB
  • references/numbers-time-and-randomness.md5.7 KB
  • references/performance-and-gc.md9.9 KB
  • references/persistence-and-data-exchange.md5.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.