--输出日志-- function Log(str) if LogModeLevel == 0 then Util.Log(debug.traceback(str)) end end --警告日志-- function LogWarn(str) if LogModeLevel >= 0 and LogModeLevel <= 1 then Util.LogWarning(debug.traceback(str)) end end --错误日志-- function LogError(str) if LogModeLevel <= 2 and LogModeLevel >= 0 then Util.LogError(debug.traceback(str)) end end -- print function print(str) Log(str) end -- 有颜色的log可自定义 -- function LogRed( str ) Log(""..str.."") end function LogGreen( str ) Log(""..str.."") end function LogBlue( str ) Log(""..str.."") end function LogPink(str) Log(""..str.."") end function LogYellow(str) Log(""..str.."") end function LogPurple(str) Log(""..str.."") end --带有颜色的打印 只支持2 4参数个数("red","") ("red","","#FFFFFF","") function LogColor(...) local args={...} if #args==2 then Log(""..args[2].."") elseif #args==4 then Log(""..args[2].."".." "..args[4].."") end end function PrintBattleTable(tb) local s = "{" if tb then for k, v in pairs(tb) do -- k if type(k) == "number" then s = s..string.format("[%s]=", k) elseif type(k) == "string" then s = s..string.format("%s=", k) elseif type(k) == "table" then s = s..string.format("[%s]=", "table") end -- v if type(v) == "number" or type(v) == "string" then s = s..v.."," elseif type(v) == "table" then s = s..PrintBattleTable(v) end end end return s.."}" end -- 打印表 function LogGreenTable(t) LogGreen(PrintBattleTable(t)) end -- 打印表 function LogRedTable(t) LogRed(PrintBattleTable(t)) end -- 打印表 function LogBlueTable(t) LogBlue(PrintBattleTable(t)) end -- 打印表 function LogPinkTable(t) LogPink(PrintBattleTable(t)) end