for k, v in ipairs(menu5) do
I am editing in the table menu5, not menu2.
And I am not doing menu5 = menu2 as before which apparenly is supposed to reference to the old table.
I wrote a table.copy function which SHOULD create a copy of the table, not a reference.
EDIT: WAIT, don't tell me that because the contents of the table are tables I'm not copying the table but referencing the sub-tables in the old table instead of creating them in the new table??
EDIT2: Should this work then?
ttable.copy = ""
ttable.copy = function(t1)
local t2 = {}
for k,v in pairs(t1) do
if type(v) == "table" then
t2[k] = ttable.copy(v)
else
t2[k] = v
end
end
return t2
end