A robust, pure Lua binary serializer specializing in userdata, custom types, cycles, and metatables.
binser is a pure Lua binary serializer that converts Lua data structures—including numbers, strings, tables, booleans, nil, userdata, and custom types—into compact binary strings. It solves the problem of safely and efficiently serializing complex data with cycles, self-references, and metatables, which text-based serializers often struggle with.
Lua developers, particularly those working on games, applications with custom data types, or projects requiring robust data persistence and exchange without security vulnerabilities from parser-based serialization.
Developers choose binser for its specialization in handling userdata and custom classes, its binary format for safety and performance, and its flexibility with custom serialization functions and templates, making it more robust than many existing Lua serializers for complex use cases.
Customizable Lua Serializer
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Avoids security risks of parser-based serializers by using a binary format, preventing code injection attacks common in text-based approaches like loadstring.
Enables serialization of userdata and custom classes from libraries like 30log and middleclass through registration functions, handling metatables efficiently.
Correctly serializes data structures with circular references and self-references, a feature many Lua serializers lack, ensuring robust persistence.
Template system reduces serialized size by specifying table layouts, avoiding key repetition—shown in examples to cut size nearly in half.
Serialized data is in binary format, making it impossible to inspect or edit without deserialization, which complicates debugging and manual adjustments.
Requires writing serialize/deserialize functions for userdata and non-table types, adding development overhead compared to drop-in serializers.
Performance is emphasized on LuaJIT; on standard Lua, the speed gains may not justify the binary complexity and setup effort.