I used it as a refrence.. not as actual code.
the reason why it has this problem is because its relational variables. Not direct data based variables.
Tables, functions, threads, and (full) userdata values are objects: variables do not actually contain these values, only references to them. Assignment, parameter passing, and function returns always manipulate references to such values; these operations do not imply any kind of copy.
There are always work arrounds but it still is retarded and half assed. If you really want good code, work with metatables. or Redesign your code so it works logically where all variables are pointers to actual data and not the other way arround.
function copyTable(old)
local new = {}
table.foreach(old, function (item) table.insert(new, item) end)
return new
end
Row = {}
block1 = {2,0,1}
Row[1] = copyTable(block1)
Row[2] = copyTable(block1)
Row[1][1] = 15
function CopyTable(old)
local new = {}
-- for i, item in ipairs(old) do table.insert(new, item) end
for i, item in ipairs(old) do new[i] = item end
return new
end
Last edited by KawaGeo on Sat Aug 19, 2006 12:27 am, edited 1 time in total.