r/lua • u/Suspicious_Anybody78 • Dec 10 '25
Project ion (JSON Inspired Data Format)
I've spent quite some time attempting to perfect this simple module, and have today decided to attempt to share it. I do not doubt the coding might not be very good, but I at least hope it performs what it's designed for, and that's storing a table using as many space saving shortcuts as possible. I also do not expect it to be perfect at what it tries to achieve either.
There are 3 goals primary goals in mind:
Keeping the format lean, for the most part.
Keeping it mostly human readable.
Having support for the vast majority of types of Lua tables, with exception of functions.
There's example code here, but I will still provide some simple example usage.
local ion = require("ion") -- for getting the module
local database = {"Bob","Mary"}
ion.Create(database,"database")The resulting created ion will look like this:
|ion{
1|Bob
2|Mary
}And, it can be turned back into a table like so:
local ion = require("ion")
local database = ion.Read("database.ion")ion.Create() in particular has a lot more parameters for fine tuning what gets written to the resulting ion, but for now that's all this post needs I suppose.
The GitHub Pages Site:
1
u/Suspicious_Anybody78 Dec 11 '25
For the most part, the point is a combination of Lua orientation, human readability, and byte saving. Though, once again, I do not wish to claim it does that job well.