A self-contained C implementation of MessagePack serialization for Lua 5.1/5.2/5.3 with no external dependencies.
lua-cmsgpack is a MessagePack implementation for Lua, written in C as a single self-contained file. It serializes Lua objects (like tables and numbers) into the compact MessagePack binary format and deserializes them back, enabling efficient data storage and transmission. It solves the need for a lightweight, dependency-free serialization library in Lua projects.
Lua developers and C programmers embedding Lua who need efficient binary serialization for data interchange, storage, or network communication in their applications.
Developers choose lua-cmsgpack for its simplicity, portability, and zero dependencies—it's just one C file that works across Lua 5.1–5.3. Its predictable handling of Lua types (like tables as arrays/maps) and safe error modes make it reliable for production use.
A self contained Lua MessagePack C implementation.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Implemented as a single C file with no external dependencies, making it trivial to embed in any project by just adding the file and a function call, as outlined in the README.
Compatible with Lua 5.1, 5.2, and 5.3, ensuring broad compatibility without needing separate builds or adjustments for common Lua versions.
Offers a 'safe' module that returns errors as (nil, errstring) pairs, preventing crashes and enabling robust error recovery in production environments.
Clearly defines conversion rules, such as tables encoding as arrays only with sequential integer keys and numbers handling based on integer vs. float precision, reducing ambiguity.
When unpacking MessagePack 64-bit integers to Lua numbers, loss of precision can occur due to Lua's floating-point representation, a limitation explicitly acknowledged in the README.
Tables are encoded as arrays only if keys are sequential integers from 1 to N without gaps, which may not align with all Lua table structures, leading to unexpected map encodings.
Does not support Lua 5.4 or newer versions, potentially requiring workarounds or alternative libraries for modern Lua ecosystems.