local function shallow_copy(t)
local out = {}
for k, v in pairs(t) do out[k] = v end
return out
end
local grid = {{1, 2}, {3, 4}}
local copy = shallow_copy(grid)
-- the inner tables are still the SAME objects
table.insert(copy[1], 99)
print(#grid[1])nested tables stay shared after a shallow copy