aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xmirror-checker.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/mirror-checker.lua b/mirror-checker.lua
index 4ebaecb..c9dd870 100755
--- a/mirror-checker.lua
+++ b/mirror-checker.lua
@@ -74,29 +74,30 @@ local url = require 'socket.url'
74 74
75-- Use this to print a table. 75-- Use this to print a table.
76printTable = function (table, space, name) 76printTable = function (table, space, name)
77 print(space .. name .. ": ") 77 if "" == space then print(space .. name .. " =") else print(space .. "[" .. name .. "] =") end
78 print(space .. "{") 78 print(space .. "{")
79 printTableSub(table, space .. " ") 79 printTableSub(table, space .. " ")
80 print(space .. "}") 80 if "" == space then print(space .. "}") else print(space .. "},") end
81end 81end
82printTableSub = function (table, space) 82printTableSub = function (table, space)
83 for k, v in pairs(table) do 83 for k, v in pairs(table) do
84 if type(k) == "string" then k = '"' .. k .. '"' end
84 if type(v) == "table" then 85 if type(v) == "table" then
85 printTable(v, space, k) 86 printTable(v, space, k)
86 elseif type(v) == "string" then 87 elseif type(v) == "string" then
87 print(space .. k .. ': "' .. v .. '";') 88 print(space .. "[" .. k .. "] = '" .. v .. "';")
88 elseif type(v) == "function" then 89 elseif type(v) == "function" then
89 print(space .. "function " .. k .. "();") 90 print(space .. "[" .. k .. "] = function ();")
90 elseif type(v) == "userdata" then 91 elseif type(v) == "userdata" then
91 print(space .. "userdata " .. k .. ";") 92 print(space .. "userdata " .. "[" .. k .. "];")
92 elseif type(v) == "boolean" then 93 elseif type(v) == "boolean" then
93 if (v) then 94 if (v) then
94 print(space .. "boolean " .. k .. " TRUE ;") 95 print(space .. "boolean " .. "[" .. k .. "] = true;")
95 else 96 else
96 print(space .. "boolean " .. k .. " FALSE ;") 97 print(space .. "boolean " .. "[" .. k .. "] = false;")
97 end 98 end
98 else 99 else
99 print(space .. k .. ": " .. v .. ";") 100 print(space .. "[" .. k .. "] = " .. v .. ";")
100 end 101 end
101 end 102 end
102end 103end