Open main menu
Home
Random
Nearby
Log in
Settings
About Kancolle Wiki
Disclaimers
Kancolle Wiki
Search
Changes
← Older edit
Newer edit →
Module:Core
(view source)
Revision as of 05:11, 29 August 2018
20 bytes removed
,
6 years ago
no edit summary
Line 277:
Line 277:
end
end
−
function Utils.
show
(x, i)
+
local function showValue(v)
+
return type(v) == "string" and string.format('"%s"', v) or type(v) == "function" and '"function"' or tostring(v)
+
end
+
+
function Utils.
json
(x, i)
i = i or 0
i = i or 0
local r = ""
local r = ""
Line 283:
Line 287:
r = string.rep(" ", i) .. "{\n"
r = string.rep(" ", i) .. "{\n"
for k, v in pairs(x) do
for k, v in pairs(x) do
−
if type(v) == "table" then
+
r = r .. string.rep(" ", i + 1) .. tostring(k) .. ": " .. Utils.
json
(v, i + 1) .. "\n"
−
r = r .. string.rep(" ", i + 1) .. tostring(k) .. ": " .. Utils.
show
(v, i + 1) .. "\n"
−
else
−
r = r .. string.rep(" ", i + 1) .. tostring(k) .. ": " .. tostring(v) .. "\n"
−
end
end
end
r = r .. string.rep(" ", i) .. "}\n"
r = r .. string.rep(" ", i) .. "}\n"
else
else
−
return
tostring
(x)
+
return
showValue
(x)
end
end
return r
return r
がか
cssedit, gkautomate
7,064
edits