Module:Categorizer export
From Soyjak Wiki, the free ensoyclopedia
Jump to navigationJump to search
| This module is rated as ready for general use. It is considered stable and may be used wherever appropriate. Improvements should be developed and tested in a sandbox before changing the live module. |
| This module depends on the following other modules: |
Returns a categorizer's resolved state for a set of arguments as JSON. It is ONLY intended for bots that can use a simple API trick to retrieve the JSON without the result ever being saved to a page.
This module by design is never transcluded, so it will always show no uses.
Usage
Do not use this module anywhere on your own. To try it by hand, paste an invocation into Special:ExpandTemplates.
Output
A single JSON object, whatever the module's _state returns.
The module emits no categories, and it does not apply the categorizer's namespace or nocat checks.
local p = {}
local core = require('Module:Infobox categorizer')
function p.state(frame)
local args = frame.args
local name = 'Module:' .. core.trim(args._module)
local subject = require(name)
if type(subject._state) ~= 'function' then core.devError('export: ' .. name .. ' has no _state') end
return mw.text.jsonEncode(subject._state(args))
end
return p

