cbor / cbor.github.io

cbor.io web site
74 stars 33 forks source link

another implementation: lua-ConciseSerialization #23

Closed fperrad closed 7 years ago

fperrad commented 7 years ago

lua-ConciseSerialization is a pure Lua implementation of CBOR.

Install via luarocks

See http://fperrad.github.io/lua-ConciseSerialization/

cabo commented 7 years ago

Thank you for the pointer! I added it. What is your approach for distinguishing between array and map on serialization (Lua only has tables, IIRC)?

fperrad commented 7 years ago

See https://github.com/fperrad/lua-ConciseSerialization/blob/master/docs/cbor.md#data-conversion and https://github.com/fperrad/lua-ConciseSerialization/blob/master/docs/cbor.md#set_array-str-

I've already did the same thing with https://fperrad.github.io/lua-MessagePack/

cabo commented 7 years ago

Ah, right. (You probably don't mean "greater than 1", though :-)

fperrad commented 7 years ago

It is intentional, Lua arrays are 1-based. See https://en.wikipedia.org/wiki/Lua_(programming_language)#As_array

cabo commented 7 years ago

Sure, but "A Lua table is converted into a CBOR array only if all the keys are composed of positive integers greater than 1, [...]." means that any table that has an element with an index of 1 (i.e., most array-like data) is not converted to a CBOR array. I don't think that is what you mean.

fperrad commented 7 years ago

Right, composed of positive integers greater or equal than 1 or composed of strictly positive integers

cabo commented 7 years ago

(Your docs still seem to say "positive integers greater than 1, ".) Closing this issue now; thanks again for the pointer.