hrm, i’m looking at the tabutil.save for the first time
works great! thanks @markeats for adding that.
NB though, the format for nested tables is kinda funky.
given this guy:
a = { "one", {2, 3}, {four=4, fivesix={5,6}} }
calling tabutil.save(a, 'a_save.lua') produces a file like this:
return {
-- Table: {1}
{
"one",
{2},
{3},
},
-- Table: {2}
{
2,
3,
},
-- Table: {3}
{
["fivesix"]={4},
["four"]=4,
},
-- Table: {4}
{
5,
6,
},
}
so it’s a kind of “flattened tree” - not sure if there is a more accurate technical term for this. it’s clear enough how it works, but not exactly intuitive to edit directly. (OTOH something i can definitely live with.)
i’m a little surprised; wonder if there is a way to simply serialize a table to something that looks more like its declaration in lua. (maybe making some assumptions like no metatables, no cycles.)
here’s a boatload of other table serialization methods implemented in lua, maybe there’s alternatives to consider:
http://lua-users.org/wiki/TableSerialization