Repository navigation
Releases: iryont/lua-struct
Releases · iryont/lua-struct
Release list
1.0.0
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
lwere wrong,-1came back as0(#3). - Integers above 2^53 lost their low bits with Lua 5.3+, the whole 64 bit range is exact there now.
fwas truncated instead of rounded, and infinity, NaN, negative zero and subnormal numbers were packed as garbage.cdid not work without a number (#4).- The library did not load with Lua 5.5 and needed
math.frexpandmath.ldexp. - Invalid format options, wrong arguments and data which is too short raise an error which names the problem.
New
unpackreturns the position where it stopped reading (#5) and accepts a negative start position.struct.size(format).- Options
x, spaces,inandInwith 1 to 8 bytes,Tand!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