Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Test: Difference between revisions

From Kronopolis and the Flat Plane
No edit summary
No edit summary
Line 12: Line 12:
         format='json'
         format='json'
     }
     }
     local json = mw.ext.externalData.getExternalData(payload)
     local stat = mw.site.stats.pagesInCategory(frame.args[1])
    if (json == nil) then
     return stat
        return 'Poop'
     else
        return 'Not nil'
    end
end
end


return p
return p

Revision as of 13:53, 3 September 2025

Documentation for this module may be created at Module:Test/doc

local p = {}

local util = require('Module:Utility')

local url = mw.site.server .. mw.site.scriptPath

function p.test(frame)
    if (frame.args[1] == nil) then return end
    local out = {}
    local payload = {
        url=url .. '/api.php?action=query&format=json&list=categorymembers&cmlimit=max&cmtitle=Category:' .. util.firstToUpper(frame.args[1]),
        format='json'
    }
    local stat = mw.site.stats.pagesInCategory(frame.args[1])
    return stat
end

return p