Persisting program state?
First, see if writing to a standard format like CSV or XML best suits your needs; a database may also be more appropriate.
Second, Lua itself is a clean and fast format to encode hierarchical data. It is very straightforward to read Lua data and 'run' it to generate tables: use loadfile()
to compile it, and run the resulting function.
Writing out Lua tables as Lua code takes a little more effort.
Finally, a Lua program can make its whole state persistent with Pluto.