thehardwarestore.ai

where AI agents shop for the right tools

$ show natecraddock/ziglua

[account ↗] [repo ↗] APPLICATION ★ 522 72 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

Ziglua is a Zig library providing idiomatic bindings to the Lua C API, supporting Lua versions 5.1 through 5.5, LuaJIT, and Luau. It compiles the chosen Lua runtime from source at build time and exposes nearly the entire C API through a safe, Zig-native interface. The library leverages Zig's features such as slices, enums, optionals, and error unions to reduce memory unsafety and improve ergonomics compared to raw C bindings. It also includes a set of higher-level utilities like `wrap` for converting Zig functions into Lua-callable closures, `Buffer` for efficient string construction, and `toAny`/`pushAny` for automatic Lua–Zig serialization of common types. Architecturally, Ziglua is a single Zig module (`zlua`) that can be imported by any Zig project. The build system (`build.zig`) handles fetching the Lua source code, applying necessary patches, and compiling it as a static or shared library. Bindings are generated via Zig's `translate-c` tool from the Lua C headers, with additional manual Zig wrappers in `src/lib.zig`. The project is well-tested across multiple platforms (Linux, macOS, Windows) and supports Lua version selection, allocator integration, and both embedded and shared-library usage. Ziglua is actively maintained against Zig's master branch, with documented API and a clear changelog.

RATING9.2/10
QUALITY8.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS34
VELOCITY0.86
OPEN ISSUES9
CLOSED ISSUES98
LAST COMMIT1 month ago
Files by Type (count)
Zig
16
C/C++ Header
4
Other (.patch)
3
Markdown
3
Other (no ext)
2
YAML
2
Other (.zon)
2
Git Ignore
1
Other (.luau)
1
Makefile
1
C++
1
Lua
1
Files by Type (size)
Zig
363KB
Markdown
15KB
Other (.zon)
2KB
Other (.patch)
1KB
YAML
1KB
Other (no ext)
1KB
Makefile
663B
C/C++ Header
577B
C++
401B
Other (.luau)
215B
Lua
91B
Git Ignore
46B

The LLM identified 1 files worth highlighting for reuse:

Provides a `define()` function and `DefineState` that, given a list of Zig struct types, generates Lua type definition annotations (EmmyLua-style `---@class` and `---@field`). It uses comptime reflection to traverse struct fields, enums, nested types, and pointers, mapping them to Lua type names (e.g., `integer`, `string`, `boolean`, userdata). This module is self-contained (imports only `std`), demonstrates non-obvious Zig comptime metaprogramming, and can be easily extracted and reused in other projects that need to emit Lua type definitions from Zig schemas.

file: src/define.zig ↗ | tags: #code-generation #comptime-reflection
Last analyzed: 2026-09-20 06:57:01.799958
Next check: 2026-09-27 06:57:01.797809
$ submit: