master
parent
0eb369077d
commit
389ce15e23
|
|
@ -380,3 +380,112 @@ function printlog(...)
|
||||||
print(...)
|
print(...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function TableToString(t, indent, visited)
|
||||||
|
if type(t) ~= "table" then
|
||||||
|
if type(t) == "string" then
|
||||||
|
return '"' .. t:gsub('["\\]', '\\%0') .. '"'
|
||||||
|
elseif type(t) == "number" or type(t) == "boolean" then
|
||||||
|
return tostring(t)
|
||||||
|
elseif type(t) == "function" then
|
||||||
|
-- 尝试获取函数名
|
||||||
|
local info = debug.getinfo(t, "n")
|
||||||
|
if info and info.name and info.name ~= "" then
|
||||||
|
return '"<function: ' .. info.name .. '>"'
|
||||||
|
else
|
||||||
|
return '"<function>"'
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return '"<' .. type(t) .. '>"'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
visited = visited or {}
|
||||||
|
if visited[t] then
|
||||||
|
return '"<cyclic reference>"'
|
||||||
|
end
|
||||||
|
visited[t] = true
|
||||||
|
|
||||||
|
indent = indent or ""
|
||||||
|
local nextIndent = indent .. " "
|
||||||
|
|
||||||
|
-- 更准确的数组检测
|
||||||
|
local isArray = true
|
||||||
|
local maxIndex = 0
|
||||||
|
for k in pairs(t) do
|
||||||
|
if type(k) ~= "number" or k < 1 or k ~= math.floor(k) then
|
||||||
|
isArray = false
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if k > maxIndex then
|
||||||
|
maxIndex = k
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 检查连续性
|
||||||
|
if isArray and maxIndex > 0 then
|
||||||
|
for i = 1, maxIndex do
|
||||||
|
if t[i] == nil then
|
||||||
|
isArray = false
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local result = ""
|
||||||
|
|
||||||
|
if isArray then
|
||||||
|
result = result .. "["
|
||||||
|
local parts = {}
|
||||||
|
for i = 1, maxIndex do
|
||||||
|
parts[i] = TableToString(t[i], nextIndent, visited)
|
||||||
|
end
|
||||||
|
result = result .. table.concat(parts, ",")
|
||||||
|
result = result .. "]"
|
||||||
|
else
|
||||||
|
result = result .. "{\n"
|
||||||
|
local parts = {}
|
||||||
|
local count = 0
|
||||||
|
|
||||||
|
for k, v in pairs(t) do
|
||||||
|
count = count + 1
|
||||||
|
local key
|
||||||
|
if type(k) == "string" and string.match(k, "^[a-zA-Z_][a-zA-Z0-9_]*$") then
|
||||||
|
key = '"' .. k .. '"' -- 即使是标识符也加双引号,保持JSON格式
|
||||||
|
else
|
||||||
|
key = '"' .. tostring(k):gsub('["\\]', '\\%0') .. '"'
|
||||||
|
end
|
||||||
|
|
||||||
|
local valueStr
|
||||||
|
if type(v) == "function" then
|
||||||
|
-- 对函数进行特殊处理,只显示方法名
|
||||||
|
local info = debug.getinfo(v, "n")
|
||||||
|
if info and info.name and info.name ~= "" then
|
||||||
|
valueStr = '"<function: ' .. info.name .. '>"'
|
||||||
|
else
|
||||||
|
valueStr = '"<function>"'
|
||||||
|
end
|
||||||
|
else
|
||||||
|
valueStr = TableToString(v, nextIndent, visited)
|
||||||
|
end
|
||||||
|
|
||||||
|
parts[count] = nextIndent .. key .. ": " .. valueStr
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 按键名排序,使输出更一致
|
||||||
|
table.sort(parts, function(a, b)
|
||||||
|
local keyA = a:match('^%s*"([^"]+)"')
|
||||||
|
local keyB = b:match('^%s*"([^"]+)"')
|
||||||
|
return (keyA or "") < (keyB or "")
|
||||||
|
end)
|
||||||
|
|
||||||
|
result = result .. table.concat(parts, ",\n")
|
||||||
|
if count > 0 then
|
||||||
|
result = result .. "\n" .. indent
|
||||||
|
end
|
||||||
|
result = result .. "}"
|
||||||
|
end
|
||||||
|
|
||||||
|
visited[t] = nil
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"objectStatus": {
|
||||||
|
"n76_oqog": {
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"n77_oqog": {
|
||||||
|
"collapsed": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<relation target="" sidePair="center-center,bottom-bottom"/>
|
<relation target="" sidePair="center-center,bottom-bottom"/>
|
||||||
</component>
|
</component>
|
||||||
<component id="n37_n1ry" name="mask_liangpai" src="peuq59" fileName="component/Component1.xml" xy="868,-91" size="5,5"/>
|
<component id="n37_n1ry" name="mask_liangpai" src="peuq59" fileName="component/Component1.xml" xy="868,-91" size="5,5"/>
|
||||||
<component id="n38_ey1o" name="n38" src="peuq5b" fileName="component/Main/component/PromptOutCard.xml" xy="16,-177" size="1577,170">
|
<component id="n38_ey1o" name="n38" src="peuq5b" fileName="component/Main/component/PromptOutCard.xml" xy="16,-177" size="1577,5">
|
||||||
<gearDisplay controller="chupai" pages="1"/>
|
<gearDisplay controller="chupai" pages="1"/>
|
||||||
</component>
|
</component>
|
||||||
<component id="n27" name="area_outcard_list" src="peuq59" fileName="component/Component1.xml" xy="1398,-838" size="218,155">
|
<component id="n27" name="area_outcard_list" src="peuq59" fileName="component/Component1.xml" xy="1398,-838" size="218,155">
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<component size="678,162">
|
<component size="678,162">
|
||||||
<displayList>
|
<displayList>
|
||||||
<list id="n1_lr5d" name="lit_fanzi" xy="0,0" size="678,162" layout="row" selectionMode="none" defaultItem="ui://lkq9ne9speuq9k" autoItemSize="false" align="right" vAlign="middle">
|
<list id="n1_lr5d" name="lit_fanzi" xy="0,0" size="678,162" layout="row" selectionMode="none" colGap="50" defaultItem="ui://lkq9ne9speuq9k" autoItemSize="false" align="right" vAlign="middle">
|
||||||
<item/>
|
<item/>
|
||||||
<item/>
|
<item/>
|
||||||
<item/>
|
<item/>
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue