ltdiff – diffing and patching of Lua tables released

October 11, 2014

Just published ltdiff a Lua snipped that allows diffing and patching of Lua tables. It is published on MoonRocks. The Rock page can be found here: http://rocks.moonscript.org/modules/fysx/ltdiff and the repository is here: https://github.com/martinfelis/luatablediff.

ltdiff can be used to reduce the amount of data needed to be transmitted in order to synchronize two tables. Beware that there is some overhead especially for nested tables with only few entries.

Also when doing version control of data stored in Lua files this can be handy to see what has changed.

I originally wrote the script when I implemented the Quake3 networking model for a prototype game in LÖVE. The Quake3 networking model is very elegant that automatically reduces traffic by sending only changes to each client that haven’t been sent already (which is done with similar code published now in ltdiff). A good introduction to the model can be found here: http://fabiensanglard.net/quake3/network.php. I dearly hope to find some time to actually turn that prototype into an actual game.

Enjoy!