[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [ANN] VStruct, the versatile struct library - 1.0 beta 1
- From: Ben Kelly <ranavin@...>
- Date: Sun, 25 May 2008 18:01:37 -0400
What is it?
A library for packing and unpacking binary data, not unlike lhf's lpack
or Roberto's struct library. This is the beta 1 release; feedback, bug
reports, patches, criticism, proofreading, anything and everything else
welcome. Minor feature additions will probably go into beta 2 (there's
already one planned); major feature changes won't show up until 1.1.
Why use it?
- read and write support for signed and unsigned integers, fixed point
rationals, fixed-length, null-terminated and null-padded strings,
skipping and padding, booleans, and bitmasks
- unpack/pack from/to strings, files, or anything that supports
file-like :read (and optionally :seek) operations
- any type can be any byte-aligned width - 24-bit integers? booleans
stored as uint32_ts? 128-bit masks? No problem.
- supports naming, grouping and repetition of fields (and groups, nested
arbitrarily deep). You can specify the structure of the data in the
format string and get back a table with conveniently named fields (and
possibly subtables); and then you can unpack an array of 10,000 of them
just by putting "* 10000" on the end.
- written entirely in Lua, and thus very portable and easy to extend.
Why NOT use it?
- written entirely in Lua, and thus slower and more memory-hungry than C
equivalents
- no support for IEEE floats (yet - planned for 1.1)
- no support for bit-aligned fields (yet - planned for 1.1)
What's planned for beta 2?
- A "counted string" type, which reads an unsigned, followed by a string
of the length indicated by the unsigned, as a single format specifier
Where is it?
The beta 1 package can be found in tar.bz2 format here:
http://www.funkyhorror.net/toxicfrog/projects/vstruct-1.0b1.tar.bz2
The project is also available via public read-only git repository:
git://orias.homeip.net/ben/lua/struct.git
Documentation and credits are in the README. Put it someplace in your
LUA_PATH which looks for "?/init.lua".
Enjoy.
Ben Kelly