Changes

no edit summary
Line 275: Line 275:  
         mw.log(tostring(x) .. " : " .. type(x))
 
         mw.log(tostring(x) .. " : " .. type(x))
 
     end
 
     end
 +
end
 +
 +
function Utils.show(x, i)
 +
    i = i or 0
 +
    local r = ""
 +
    if type(x) == "table" then
 +
        r = string.rep("  ", i) .. "{\n"
 +
        for k, v in pairs(x) do
 +
            if type(v) == "table" then
 +
                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
 +
        r = r .. string.rep("  ", i) .. "}\n"
 +
    else
 +
        return tostring(x)
 +
    end
 +
    return r
 
end
 
end
  
cssedit, gkautomate
6,926

edits