battlemain

back_recharge
wangyuan 2019-05-15 12:05:54 +08:00
parent 8f5c282aaf
commit 55f5ee6eb5
1 changed files with 18 additions and 4 deletions

View File

@ -66,27 +66,41 @@ end
local function PrintTable(tb) local function PrintTable(tb)
local indent_str = "{" local indent_str = "{"
local count = 0
for k,v in pairs(tb) do
count = count + 1
end
for k=1, #tb do for k=1, #tb do
local v = tb[k] local v = tb[k]
if type(v) == "table" then if type(v) == "table" then
indent_str = indent_str .. PrintTable(v) indent_str = indent_str .. PrintTable(v)
else else
indent_str = indent_str .. tostring(v).."," indent_str = indent_str .. tostring(v)
end
if k < count then
indent_str = indent_str..","
end end
end end
for k,v in newPairs(tb) do
local index = 0
for k,v in pairs(tb) do
index = index + 1
if type(k) ~= "number" then if type(k) ~= "number" then
if type(v) == "table" then if type(v) == "table" then
indent_str = string.format("%s%s=%s", indent_str, tostring(k), PrintTable(v)) indent_str = string.format("%s%s=%s", indent_str, tostring(k), PrintTable(v))
else else
indent_str = string.format("%s%s=%s", indent_str, tostring(k), tostring(v)..",") indent_str = string.format("%s%s=%s", indent_str, tostring(k), tostring(v))
end
if index < count then
indent_str = indent_str .. ","
end end
end end
end end
indent_str = indent_str .. "}," indent_str = indent_str .. "}"
return indent_str return indent_str
end end
--捕获异常,并输出错误日志 --捕获异常,并输出错误日志
local function error( err ) local function error( err )
local time = string.format("%d-%d-%d-%d-%d-%d", local time = string.format("%d-%d-%d-%d-%d-%d",