• Stars
    star
    74
  • Rank 429,106 (Top 9 %)
  • Language
    Lua
  • License
    MIT License
  • Created about 11 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A fast, robust, richly-featured table serialisation library for Lua

Since 2016-02-16, Ser is deprecated. I will still fix reported bugs, but for new projects, I recommend bitser if you're using LuaJIT, and binser otherwise.

Ser

Ser is a fast, robust, richly-featured table serialization library for Lua. It was specifically written to store configuration and save files for LÖVE games, but can be used anywhere.

Originally, this was the code to write save games for Space, but was released as a stand-alone library after many much-needed improvements.

Like Space itself, you use, distribute and extend Ser under the terms of the MIT license.

Simple

Ser is very simple and easy to use:

local serialize = require 'ser'

print(serialize({"Hello", world = true}))
-- prints:
-- return {"Hello", world = true}

Fast

Using Serpent's benchmark code, Ser is 33% faster than Serpent.

Robust

Sometimes you have strange, non-euclidean geometries in your table constructions. It happens, I don't judge. Ser can deal with that, where some other serialization libraries cry "Iä! Iä! Cthulhu fhtagn!" and give up — or worse, silently produce incorrect data.

local serialize = require 'ser'

local cthulhu = {{}, {}, {}}
cthulhu.fhtagn = cthulhu
cthulhu[1][cthulhu[2]] = cthulhu[3]
cthulhu[2][cthulhu[1]] = cthulhu[2]
cthulhu[3][cthulhu[3]] = cthulhu
print(serialize(cthulhu))
-- prints:
-- local _3 = {}
-- local _2 = {}
-- local _1 = {[_2] = _3}
-- local _0 = {_1, _2, _3}
-- _0.fhtagn = _0
-- _2[_1] = _2
-- _3[_3] = _0
-- return _0

Tested

Check out tests.lua to see how Ser behaves with all kinds of inputs.

Other solutions

Check out the Lua-users wiki for other libraries that do roughly the same thing.

See also

  • Lady: for trusted-source savegames
  • Smallfolk: for untrusted-source serialization

More Repositories

1

bitser

Serializes and deserializes Lua values with LuaJIT
Lua
156
star
2

richtext

A text and image layout library for LÖVE
Lua
43
star
3

Lady

Saving and loading LÖVE savegames, based on Ser
Lua
37
star
4

Smallfolk

A fast, robust, secure, richly-featured table serialisation library for Lua
Lua
21
star
5

deja

The Déjà Vu programming language
C
15
star
6

space

A small space shooter -- IN LÖVE
Lua
13
star
7

suzy

A three-dimensional esoteric programming language
Python
8
star
8

adventure

A text adventure library in Lua
Lua
8
star
9

luahub

A wrapper library to access the GitHub API from Lua
Lua
7
star
10

adv-menu

A more advanced in-game menu for PyGame
Python
6
star
11

wurm

A simple sqlite3-based ORM for Python
Python
5
star
12

base116676

Cram data in a small number of code points
Python
4
star
13

isle

an interesting scriping language, inspired by Ruby, Lua, Python and Déjà Vu
Python
4
star
14

loveify

Changes .zip or .tar.gz files as downloaded from GitHub to .love files
Python
3
star
15

gvx.github.com

gvx GitHub Userpage
CSS
2
star
16

lith

A minimal data description language
Python
2
star
17

platformplanet

A small platform game, based on the concept and code of SpaceFlight2D
Python
2
star
18

sanity

Pre- and postcondition checker for Python 3
Python
2
star
19

Conq-rer

A Risk-implementation in Löve
Lua
2
star
20

invader

A quick and arcade-ish space stragegy game
Lua
2
star
21

dejavu

Déjà Vu is a byte-compiled language, which mixes Python and Forth
Python
2
star
22

altworld

A semi-Wiki system.
Python
2
star
23

openlife

An extensible people simulation game. This project isn't dead, but this name is.
Python
2
star
24

tutorialsource

Several Python tutorials, pretending to be source code.
Python
2
star
25

spaceflight2d

A not-so-small 2D space shooter
Python
2
star
26

botweeter

IRC bots + Twitter. This is the "+".
Python
1
star
27

a-whiff-of-steam

A Whiff of Steam (updated from Codaset)
Lua
1
star
28

stork

Almost entirely unlike a bird, this is scene-oriented software for writing stories, made with PyKDE
1
star
29

lua-tarpit

A fork of Lua, making it into a Turing tarpit
C
1
star
30

skeme

A top-down scheme generator using pycairo
Python
1
star
31

kibot

Kibot Junior, a modular IRC bot for #kiru
Python
1
star
32

lazy-lith

A minimal lazy programming language based on Lith
Python
1
star
33

generate-html

Generate HTML5 with Python generators
Python
1
star
34

translit

A small transliteration and transformation application for Ubuntu
Python
1
star
35

dolpi

Dol Pi is a constructed (human) language
Python
1
star
36

vinix

A Vim clone that can read, edit and write ODT files | superseded by Ovic
Python
1
star
37

wrong

The Wrong content processor
Python
1
star