Line 175:
Line 175:
function Utils.requireModule(name)
function Utils.requireModule(name)
return pcall(function () return require(string.format("Module:%s", name)) end)
return pcall(function () return require(string.format("Module:%s", name)) end)
+
end
+
+
-- * Testing functions.
+
+
function Utils.debugPrint(x, i)
+
i = i or 0
+
if type(x) == "table" then
+
for k, v in pairs(x) do
+
mw.log(
+
string.rep(" ", i) .. tostring(k) .. " : " .. type(k) .. " = " ..
+
(type(v) == "table" and "table" or tostring(v) .. " : " .. type(v))
+
)
+
if type(v) == "table" then
+
debugPrint(v, i + 1)
+
end
+
end
+
else
+
mw.log(tostring(x) .. " : " .. type(x))
+
end
end
end