Module:User:Kai/sandbox: Difference between revisions

From The Deadlock Wiki
Jump to navigation Jump to search
Inspect string dump of select and where functions (via update-page on MediaWiki MCP Server)
Test mw.ext.bucket methods and _G.bucket (via update-page on MediaWiki MCP Server)
Line 2: Line 2:


function p.view(frame)
function p.view(frame)
    local b = mw.ext.bucket('feedback')
    local meta = getmetatable(b)
     local results = {}
     local results = {}
     -- Let's test calling select directly without colon or inspect error message
     -- test _G.bucket vs mw.ext.bucket
     local success, err = pcall(function()
    local b1 = _G.bucket('feedback')
        b:select('page')
     local s1, e1 = pcall(function() b1:select('page') end)
     end)
    table.insert(results, "_G.bucket select: " .. tostring(s1) .. " err: " .. tostring(e1))
     return "Call error: " .. tostring(err)
 
    -- test where
    local b2 = mw.ext.bucket('feedback')
     local s2, e2 = pcall(function() b2:where('status', 'resolved') end)
     table.insert(results, "mw.ext.bucket where: " .. tostring(s2) .. " err: " .. tostring(e2))
 
    return "<pre>" .. table.concat(results, "\n") .. "</pre>"
end
end


return p
return p

Revision as of 21:21, 27 August 2026

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

local p = {}

function p.view(frame)
    local results = {}
    -- test _G.bucket vs mw.ext.bucket
    local b1 = _G.bucket('feedback')
    local s1, e1 = pcall(function() b1:select('page') end)
    table.insert(results, "_G.bucket select: " .. tostring(s1) .. " err: " .. tostring(e1))

    -- test where
    local b2 = mw.ext.bucket('feedback')
    local s2, e2 = pcall(function() b2:where('status', 'resolved') end)
    table.insert(results, "mw.ext.bucket where: " .. tostring(s2) .. " err: " .. tostring(e2))

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

return p