Serializes and deserializes Lua values with LuaJIT
Go to file
Jasmijn Wellner d30f0c7aca Fixed #18
Bug was that Buffer_newDataReader() assumed buf is always writable,
which isn't the case after reading from a static buffer. Added a
separate flag to describe the nature of buf.
2020-12-26 13:58:14 +01:00
cases Don't add cdata to seen! 2020-04-29 01:42:38 +02:00
spec Don't add cdata to seen! 2020-04-29 01:42:38 +02:00
.travis.yml Fix travis build (#10) 2018-02-20 15:15:46 +01:00
bitser.lua Fixed #18 2020-12-26 13:58:14 +01:00
conf.lua Close #13 2020-04-27 19:47:09 +02:00
main.lua Add support for cdata 2020-04-28 16:51:41 +02:00
README.md Add note about JIT to readme 2017-03-29 14:50:09 +02:00
USAGE.md Release version 1.1 2020-04-29 20:37:17 +02:00

bitser

Build Status Coverage Status

Serializes and deserializes Lua values with LuaJIT.

local bitser = require 'bitser'

bitser.register('someResource', someResource)
bitser.registerClass(SomeClass)

serializedString = bitser.dumps(someValue)
someValue = bitser.loads(serializedString)

Documentation can be found in USAGE.md.

Pull requests, bug reports and other feedback welcome! ❤️

Bitser is released under the ISC license (functionally equivalent to the BSD 2-Clause and MIT licenses).

Please note that bitser requires LuaJIT for its ffi library and JIT compilation. Without JIT, it may or may not run, but it will be much slower than usual. This primarily affects Android and iOS, because JIT is disabled on those platforms.

Why would I use this?

Because it's fast. Because it produces tiny output. Because the name means "snappier" or "unfriendlier" in Dutch. Because it's safe to use with untrusted data.

Because it's inspired by binser, which is great.

How do I use the benchmark thingy?

Download zero or more of binser.lua, ser.lua, smallfolk.lua, serpent.lua and MessagePack.lua, and run:

love .

You do need LÖVE for that.

You can add more cases in the folder cases/ (check out _new.lua), and add other serializers to the benchmark in main.lua. If you do either of those things, please send me a pull request!

You can register classes?

Yes. At the moment, bitser supports MiddleClass, SECL, hump.class, Slither and Moonscript classes (and probably some other class libraries by accident).