Shortcuts: WD:SB, WD:SANDBOX
Module:Sandbox
Jump to navigation
Jump to search
Code
local p = {}
function p.hello(frame)
return mw.title.getCurrentTitle()
end
function p.flag(frame)
id = frame.args["id"]
local bestStatement = mw.wikibase.getBestStatements(id, "P41")[1]["mainsnak"]["datavalue"]["value"]
return bestStatement
end
function p.nosubst(frame)
return "{{sandbox}}"
end
function p.test(frame)
local titles = {}
while frame do
local args = {}
for arg in pairs(frame.args) do
table.insert(args, arg)
end
table.insert(titles, {frame:getTitle(), args})
frame = frame:getParent()
end
return mw.text.jsonEncode(titles)
end
return p