Module documentation
This module has various functions described below and should only be utilized on templates. To call a module in a template, insert {{#invoke:Number|function name|various parameters}} onto the template.[ Data ]
Functions | ||||
---|---|---|---|---|
Function name | Input value(s) | Output value | ||
getNum | Series Title | Amount of media within series | ||
current | Show Title, Page Name | Currently aired for current season infobox |
- For help on this module, please contact an administrator.
Visit Module:Number/doc to edit this text! (How does this work?)
--[[Category:Lua modules]]
local p = {}
local numData = mw.loadData('Module:Number/data')
function p.getNum(frame)
local show= frame.args[1]
local number={}
if numData[show]
then number=numData[show][1]
else number="0[[Category:"
.."Broken S link]]"
end
return number
end
function p.current(frame)
local show=frame.args[1]
local pagename=frame.args[2]
local currentDisplay=""
local length= mw.ustring.len(show)
local par={}
if mw.ustring.find(show,'(',1,true)==nil
then par=length
else par=mw.ustring.find(show,'(',1,true)-2
end
local title=mw.ustring.sub(show,1,par)
if numData[show]
then local season=numData[show][2]
local suggestedPN="Season "
..season
.." ("
..title
..")"
if suggestedPN==pagename and numData[show][3]>0
then currentDisplay="<small>("
..numData[show][3]
.." aired)</small>"
end
end
return frame:preprocess(currentDisplay)
end
return p
Community content is available under CC-BY-SA unless otherwise noted.