简单输出lua中table的实现

function printTab(tab,tabName,offset)
local name = tabName
if name == nil then name = “” end
if offset == nil then
print("{------------start " …name… “-------------”)
end
local off = offset
if off == nil then off = 4 end
local str = string.rep(" “, off)
for i,v in pairs(tab) do
if type(v) == “table” then
print(str … i,”{")
printTab(v,nil,off+4)
print(str … “}”)
else
if type(v) == “boolean” then
if v == true then
v = “true”
else
v = “false”
end
end
print(str … i … “==” … v)
end
end
if offset == nil then
print("}-------------end " …name… “--------------”)
end
end

与dump不一样?

嗯,不一样,维护老游戏时还没接触过quick,当时为了调试自己写了个,贴出来分享下。