copy_shape = function(s) local result = {} for k,v in pairs(s) do result[k] = v end result.data = {} for _,d in ipairs(s.data) do table.insert(result.data, d) end return result end