You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changes:
- Improve table vs. array detection
- Improve packing +-inf
- Add multiple pack/unpack support
- Add cmsgpack.safe module variant
- Add local build infrastructure for easier testing
- Add user-controlled unpack support limiting returned objects
- Add Lua 5.3 compatibility
- Remove an unnecessary malloc
- Use Lua memory allocator instead of malloc for buffer creation
Issues involved:
- closes#16 - allow multi pack/unpack by default
- closes#10 - unpack one/limit API added
- closes#13 and closes#20 - use Lua allocator
- closes#15 - (included in #16)
- ignores #22 because it's confusing
- closes#23 - fixed elsewhere
- closes#26 - extracted some useful parts from a difficult commit
- closes#28 - we started tagging versions again recently
- closes#27 - that failure case works for me now
- closes#31 - fix comment typos
I merged commits with original author information where possible, but
each commit required manual cleanup of one or more of:
formatting fixes (no tabs, please), commit message fixes (more details
please), extracting contents from a single 300 line commit with 5
different logical changes merged together, and general correctness
checking after merging with newer code.
As of this commit, all tests pass on Lua 5.1.5 and Lua 5.3-work2.
-`pack(arg1, arg2, ..., argn)` - pack any number of lua objects into one msgpack stream. returns: msgpack
56
+
-`unpack(msgpack)` - unpack all objects in msgpack to individual return values. returns: object1, object2, ..., objectN
57
+
-`unpack_one(msgpack); unpack_one(msgpack, offset)` - unpacks the first object after offset. returns: offset, object
58
+
-`unpack_limit(msgpack, limit); unpack_limit(msgpack, limit, offset)` - unpacks the first `limit` objects and returns: offset, object1, objet2, ..., objectN (up to limit, but may return fewer than limit if not that many objects remain to be unpacked)
59
+
60
+
When you reach the end of your input stream with `unpack_one` or `unpack_limit`, an offset of `-1` is returned.
61
+
62
+
You may `require "msgpack"` or you may `require "msgpack.safe"`. The safe version returns errors as (nil, errstring).
40
63
41
64
However because of the nature of Lua numerical and table type a few behavior
42
65
of the library must be well understood to avoid problems:
@@ -50,6 +73,16 @@ maps.
50
73
* When a Lua number is converted to float or double, the former is preferred if there is no loss of precision compared to the double representation.
51
74
* When a MessagePack big integer (64 bit) is converted to a Lua number it is possible that the resulting number will not represent the original number but just an approximation. This is unavoidable because the Lua numerical type is usually a double precision floating point type.
52
75
76
+
TESTING
77
+
---
78
+
79
+
Build and test:
80
+
81
+
mkdir build; cd build
82
+
cmake ..
83
+
make
84
+
lua ../test.lua
85
+
53
86
NESTED TABLES
54
87
---
55
88
Nested tables are handled correctly up to `LUACMSGPACK_MAX_NESTING` levels of
0 commit comments