diff --git a/sqr/Core/BaseTool/BaseTool.nut b/sqr/Core/BaseTool/BaseTool.nut index a848cb5..d969780 100644 --- a/sqr/Core/BaseTool/BaseTool.nut +++ b/sqr/Core/BaseTool/BaseTool.nut @@ -24,10 +24,21 @@ function print(Object) { /* * @函数作用: 深拷贝Table */ +// function sq_DeepCopy(original) { +// local Ret = Json.Encode(original); +// Ret = Json.Decode(Ret); +// return Ret; +// } function sq_DeepCopy(original) { - local Ret = Json.Encode(original); - Ret = Json.Decode(Ret); - return Ret; + local RetTable = clone(original); + foreach(Key, Value in original) { + if (typeof Value == "table") { + RetTable[Key] = sq_DeepCopy(Value); + } else if (typeof Value == "array") { + RetTable[Key] = sq_DeepCopy(Value); + } + } + return RetTable; } /*