Skip to content

Releases: iryont/lua-struct

1.0.0

Choose a tag to compare

@iryont iryont released this 21 Sep 22:23

A rewrite of pack and unpack which fixes a number of bugs and follows the struct library by Roberto Ierusalimschy more closely. Works with Lua 5.1 up to 5.5 and LuaJIT.

Fixed

  • Negative numbers unpacked from l were wrong, -1 came back as 0 (#3).
  • Integers above 2^53 lost their low bits with Lua 5.3+, the whole 64 bit range is exact there now.
  • f was truncated instead of rounded, and infinity, NaN, negative zero and subnormal numbers were packed as garbage.
  • c did not work without a number (#4).
  • The library did not load with Lua 5.5 and needed math.frexp and math.ldexp.
  • Invalid format options, wrong arguments and data which is too short raise an error which names the problem.

New

  • unpack returns the position where it stopped reading (#5) and accepts a negative start position.
  • struct.size(format).
  • Options x, spaces, in and In with 1 to 8 bytes, T and ! for alignment.
  • Faster, most of all for strings, long formats and LuaJIT.

Some of the changes can affect existing code, most of all the extra value returned by unpack. See upgrading from 0.9 in the README.

luarocks install lua-struct

0.9.2

Choose a tag to compare

@iryont iryont released this 24 Nov 08:09
a860460

Minor fixes and improvements.

0.9.1

Choose a tag to compare

@iryont iryont released this 08 Jul 19:46
4e62e1b

Bunch of fixes since the last release.

0.9.0

Choose a tag to compare

@iryont iryont released this 14 Feb 19:12
Remove publish