local p =
-- CHARTS TABLE – Wikidata entity IDs for each chart.local charts =
local getArgs = require('Module:Arguments').getArgs
local function makeInvokeFunction(funcName) -- makes a function that can be returned from #invoke, using -- . return function (frame) local args = getArgs(frame,) return p[funcName](args, frame) endend
p._main = function(args, frame) local chart = mw.ustring.upper(args[1]) local qid = args[2] if charts[chart] then chart = charts[chart] end local result = '–' local highest, references local entity = mw.wikibase.getEntity(qid) if entity and entity.claims then local data = entity.claims['P2291'] if data and data[1] then for i, v in ipairs(data) do if v.mainsnak.datavalue.value.id
p.main = makeInvokeFunction('_main')
return p