lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2016-12-03 0:37 GMT+01:00 Sean Conner <sean@conman.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
>> http://github.com/fperrad/lua-MessagePack
>>
>> 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)
>

About the Makefile, I never need to edit it;
variable acts as default value which could be overwritten by the CLI.

Typical usage:
$ make LUAVER=5.2 install

see also https://github.com/fperrad/lua-ConciseSerialization/blob/master/.travis.yml#L33
and the CI Travis result on
https://travis-ci.org/fperrad/lua-ConciseSerialization where tests are
done with 3 flavours:
$ make LUA=luajit test
$ make LUA=lua5.1 test
$ make LUA=lua5.2 test

and this script
https://github.com/fperrad/misc/blob/master/vm-script/lua/check.sh
which run many Lua interpreters and the 2 variants of the module.

François

> I have Lua itself tell me what version it is.
>
>   I found the API itself interesting.  When I wrote my CBOR module [1] 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.
>
>   -spc (It's always cool to see how others solve problems ... )
>
> [1]     https://github.com/spc476/CBOR
>