$ account starwing
This repository provides a comprehensive protobuf (Protocol Buffers) support library for Lua (versions 5.1–5.4 and LuaJIT). At its core is a high-performance C module (`pb.c`/`pb.h`) implementing protobuf wire format encoding/decoding, type management, and a memory-efficient hash table and pool. On top of this, a pure Lua module (`protoc.lua`) parses `.proto` schema files, resolving imports, types, and options, and compiles them into the binary descriptor format required by the C core. Additional Lua modules (`pb.buffer`, `pb.slice`, `pb.conv`, `pb.io`) provide low-level wire format manipulation for advanced use cases. The library supports both proto2 and proto3 syntax, including maps, oneofs, packed repeated fields, extensions, enums, custom default values, hooks, and multiple independent type states. It is well-tested with nearly 100% code coverage via GitHub Actions and Coveralls. The architecture is cleanly layered: the C core is a single-header library with its own implementation (`pb.h` with `PB_IMPLEMENTATION`), making it easy to embed into other projects. The pure Lua compiler is self-contained and can be used independently. The codebase demonstrates strong craftsmanship in both C (efficient wire format parsing, custom allocator pool, hash table) and Lua (complete recursive-descent parser with error reporting). It is actively maintained, with recent commits and support for the latest Lua versions.