Magic_GameClient/sqr/System/BaseTool/BaseTool.nut

38 lines
984 B
Plaintext

/*
文件名:BaseTool.nut
路径:BaseClass/BaseTool/BaseTool.nut
创建日期:2024-05-06 21:26
文件用途:工具类
*/
class Util {
function Output(Tobj, ...) {
local Pd = 0;
if (vargv.len() > 0) Pd = vargv[0];
local pdstr = "";
for (local i = 0; i< Pd; i++) {
pdstr += " ";
}
foreach(key, value in Tobj) {
if (type(value) == "table") {
print(pdstr + key + " : \r\n" + " " + "{");
Util.Output(value, Pd + 1);
print(pdstr + " " + "}");
} else if (type(value) == "array") {
Util.Output(value, Pd + 1);
} else {
print(pdstr + key + " : " + value);
}
}
}
function PrintTable(T) {
OutPutTable(Json.Encode(T));
}
function DeepCopy(original) {
local Ret = Json.Encode(original);
Ret = Json.Decode(Ret);
return Ret;
}
}