Results: 3Comments by: disht |
File: Toolbox 1.011-24-06 |
I think I am probably not making my...
Posted By: disht
I think I am probably not making myself clear :-)
So let's try another approach: What do you think is the difference between calling:
Toolbox:Clone({ 0, 1, { 0, } }, true)
and
Toolbox:Clone({ 0, 1, { 0, } }, false)
And a second question: Will the result of:
Toolbox:Clone({ = 1 }, true)
be a clone of the table pa...
|
File: Toolbox 1.011-22-06 |
Re: Re: Clone function is buggy
Posted By: disht
Originally posted by Kodewulf
Thanks for the feedback.
I just needed something to create shallow copies of tables, that's why I stuck Clone in the Toolbox... :) It still needs a LOT of work. I still need to figure out how to copy metatables and how to handle recursive data structures like the one in your example. If you you...
|
File: Toolbox 1.011-21-06 |
Clone function is buggy
Posted By: disht
deep or not deep does exactly the same thing. Better make this into two functions as follows:
function Toolbox:DeepClone(source)
if (type(source) ~= "table") then return source end
local target = {}
for k,v in pairs(source) do
local k2 = self:DeepClone(k, deep)
local v2 = self:DeepClone(v...
|