Module:User:Kai/sandbox

From The Deadlock Wiki
Revision as of 21:21, 27 August 2026 by Kai (talk | contribs) (Inspect bucket methods and global bucket (via update-page on MediaWiki MCP Server))
Jump to navigation Jump to search

Documentation for this module may be created at Module:User:Kai/sandbox/doc

local p = {}

function p.view(frame)
    local t = {}
    table.insert(t, "mw.ext.bucket methods:")
    for k, v in pairs(mw.ext.bucket) do
        table.insert(t, string.format("mw.ext.bucket[%s] = %s", tostring(k), type(v)))
    end
    
    local inst = mw.ext.bucket('feedback')
    table.insert(t, "\nmw.ext.bucket('feedback') keys:")
    for k, v in pairs(inst) do
        table.insert(t, string.format("inst[%s] = %s", tostring(k), type(v)))
    end

    local meta = getmetatable(inst)
    if meta then
        table.insert(t, "\ninst metatable keys:")
        for k, v in pairs(meta) do
            table.insert(t, string.format("meta[%s] = %s", tostring(k), type(v)))
        end
    end

    if _G.bucket then
        table.insert(t, "\n_G.bucket exists (" .. type(_G.bucket) .. ")")
    end

    return "<pre>" .. table.concat(t, "\n") .. "</pre>"
end

return p