[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] lua-ConciseSerialization : another pure Lua implementation of CBOR / RFC7049
- From: François Perrad <francois.perrad@...>
- Date: Sat, 3 Dec 2016 14:03:29 +0100
2016-12-03 0:37 GMT+01:00 Sean Conner <firstname.lastname@example.org>:
> It was thus said that the Great François Perrad once stated:
>> Hello list,
>> The Concise Binary Object Representation (RFC 7049) is a data format
>> whose design goals include the possibility of extremely small code size,
>> fairly small message size, and extensibility without the need for
>> version negotiation.
>> It's a pure Lua implementation, without dependency.
>> This implementation is based on my previous work on
>> The homepage is at http://fperrad.github.io/lua-ConciseSerialization/.
>> Comments and feedback are welcome.
> I noticed in your Makefile you have:
> LUAVER := 5.1
> LIBDIR := $(DPREFIX)/share/lua/$(LUAVER)
> That means you have to edit LUAVER manually. I fixed that by doing:
> LUA = lua
> LUA_VERSION = $(shell $(LUA) -e "print (_VERSION:match '^Lua (.*)')")
> LIBDIR = $(LUA_DIR)/lib/lua/$(LUA_VERSION)
> LUADIR = $(LUA_DIR)/share/lua/$(LUA_VERSION)
> I have Lua itself tell me what version it is.
> I found the API itself interesting. When I wrote my CBOR module  I
> check the strings and if they pass as a UTF-8 string, I encode the string as
> TEXT; otherwise it gets encoded as BIN. It never occured to me to have a
> function set the default behavior, and I wonder how your method would work
> with a table of mixed strings and binary data (or is that even enough of a
> concern to conern yourself with? I don't know ... ).
> You do a similar thing with arrays, but it's rather terse about the
> 'with_hole' option---how does that work? Does the code in that case look
> for a field 'n' in the table? I just assume if a table has a length
> defined, it's encoded as an ARRAY; otherwise a MAP (and because of that, an
> empty table is encoded as a MAP).
> Also, you might want to support __tocbor. The other two Lua implentations
> listed at http://cbor.io/impls.html support that. And you might want to add
> yours to that list.
About metamethod for userdata or object/table:
In fact, I prefer that kind of stuff stays in user/customer side (not
inside my module).
I just supply examples in documentation,
> -spc (It's always cool to see how others solve problems ... )
>  https://github.com/spc476/CBOR