Documentation for this module may be created at Module:Sandbox/DannyS712/learning/doc
local p = {}; --All lua modules on Wikipedia must begin by defining a variable
--that will hold their externally accessible functions.
--Such variables can have whatever name you want and may
--also contain various data as well as functions.
function p.hello( frame ) --"frame" will contain the data that Wikipedia sends this function when it runs.
local str = "Hello World!"
return str
end
function p.name ( frame )
parent = frame:getParent()
local title = parent:getTitle()
link = frame.args["link"]
if link == "yes" or link == "y" then
title = "[[" .. title .. "]]"
end
explain = frame.args["explain"]
if explain == "yes" or explain == "y" then
title = "This module was called from: " .. title
end
return title
end
function p.getFinalLocation( frame )
local sd = require "Module:SimpleDebug"
parent = frame:getParent()
local item = frame.args["title"] and mw.wikibase.getEntityIdForTitle( args["title"] ) or mw.wikibase.getEntityIdForCurrentPage() or error('No entity');
local finalEvent = mw.wikibase.getAllStatements( item, 'P3967' );
local finalEventItem = finalEvent[1]["mainsnak"]["datavalue"]["value"]["id"];
local finalEventLocation = mw.wikibase.getAllStatements( finalEventItem, 'P276' );
local location = finalEventLocation[1]["mainsnak"]["datavalue"]["value"];
sd.allidx = true;
return sd.namearray( {'item', item, 'finalEvent', finalEvent, 'finalEventItem', finalEventItem, 'finalEventLocation', finalEventLocation, 'location', location } );
end
return p