Documentation for this module may be created at Module:Sandbox/Premeditated/commons/doc
local p = {}
local WikidataIB = require("Module:WikidataIB")
-- Code from 'Module:No globals'
local mt = getmetatable(_G) or {}
function mt.__index (t, k)
if k ~= 'arg' then
error('Tried to read nil global ' .. tostring(k), 2)
end
return nil
end
function mt.__newindex(t, k, v)
if k ~= 'arg' then
error('Tried to write global ' .. tostring(k), 2)
end
rawset(t, k, v)
end
setmetatable(_G, mt)
-- End of code from 'Module:No globals'
function p.getMID()
return "M" .. mw.title.getCurrentTitle().id
end
function p.getFilename()
return mw.title.getCurrentTitle().nsText .. ':' .. mw.title.getCurrentTitle().text
end
function p.getP180vals(frame)
local mid = frame.args[1]
local prefix = frame.args[2] or ''
local postfix = frame.args[3] or ' '
local text = ''
local tablevals = mw.wikibase.getBestStatements( mid, 'P180')
for i, v in ipairs(tablevals) do
text = text .. prefix .. v.mainsnak.datavalue.value.id .. postfix
end
return text
end
return p