Jump to content

Module talk:Sandbox/Johnuniq/debug

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

mw.dumpObject(t)

[edit]

table#1 {

   "one",
   "two",
   [-1] = "negative one",
   [0.5] = "one half",
   [99] = "ninety nine",
   [100] = "one hundred",
   [" "] = "space",
   ["1 –◆— z"] = "unicode",
   ["alpha"] = "aaa",
   ["beta"] = "bbb",
   ["c"] = 123,
   ["data"] = 2,
   ["testcase"] = table#1,
   ["z"] = "zoo",

}

Module:Dump

[edit]
testcase = {  -- table_1
    "one",
    "two",
    [-1] = "negative one",
    [0.5] = "one half",
    [99] = "ninety nine",
    [100] = "one hundred",
    [" "] = "space",
    ["1 –◆— z"] = "unicode",
    alpha = "aaa",
    beta = "bbb",
    c = 123,
    data = {  -- table_2
        __metatable = {
            __index = function_1,
            __tostring = function_2,
        },
        "three",
        "four",
        [false] = "F",
        [true] = "T",
        function_3 = "dumper",
        F = false,
        T = true,
        alpha2 = "aaa2",
        beta2 = "bbb2",
        c2 = 1234,
        data2 = {
            "five",
            "six",
            alpha3 = "aaa3",
            beta3 = "bbb3",
            c3 = 12345,
            fruit = {  -- table_5
                "apple",
                "banana",
                [0] = "zero",
                back = table_2,  -- repeat
                table_6 = "anon",
            },
            me = table_1,  -- repeat
            table_5 = "fruit",
        },
        dumper = function_3,
        me = table_2,  -- self
    },
    testcase = table_1,  -- self
    z = "zoo",
}