Now we don't save a bunch of irrelevant fields from editor buffers, just lines.
The cost: autosave every 3 seconds becomes much more expensive.
IUQLOMXAIPG3CP57XSE3GVWJE56AWMSN2G55NZRHKSAMZE5ZBIRAC
table.copy = function(h)
local result = {}
for k,v in pairs(h) do
result[k] = v
end
return result
end
local data = {next=First_available_id}
-- save a copy of Nodes with various fields deleted
local kvs = {}
for k,v in pairs(Nodes) do
v = table.copy(v)
v.data = {}
for i,l in ipairs(v.editor.lines) do
table.insert(v.data, l.data)
end
v.editor = nil
table.insert(kvs, {k, v})
end
-- sort the copy to avoid spurious diffs in version control
table.sort(kvs, function(a, b) return a[1] < b[1] end)
data.nodes = Nodes