Module:Episode: Difference between revisions
Appearance
Content deleted Content added
Created page with "local data = mw.loadData("Module:Episode/data") local p={} function p.getInfo(frame) local episode = frame.args[1] -- for ex. "chilren of the gods" local nmspace, episodelink, episodetitle = unpack(data[episode] or {}) if data[episode] == "" or nil then return string.format("%s", episodelink, episodetitle) else return string.format("%s", nmespace, episodelink, episodetitle) end end return p" |
No edit summary |
||
| Line 3: | Line 3: | ||
function p.getInfo(frame) |
function p.getInfo(frame) |
||
local episode = frame.args[1] -- for ex. "chilren of the gods" |
local episode = string.lower(frame.args[1]) -- for ex. "chilren of the gods" |
||
local nmspace, episodelink, episodetitle = unpack(data[episode] or {}) |
local nmspace, episodelink, episodetitle = unpack(data[episode] or {}) |
||
if |
if nmspace[episode] == "" or nil then |
||
return string.format("[[%s|%s]]", episodelink, episodetitle) |
return string.format("[[%s|%s]]", episodelink, episodetitle) |
||
else |
else |
||
Revision as of 16:16, 21 July 2025
| You might want to create a documentation page for this Scribunto module. Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this module. |
local data = mw.loadData("Module:Episode/data")
local p={}
function p.getInfo(frame)
local episode = string.lower(frame.args[1]) -- for ex. "chilren of the gods"
local nmspace, episodelink, episodetitle = unpack(data[episode] or {})
if nmspace[episode] == "" or nil then
return string.format("[[%s|%s]]", episodelink, episodetitle)
else
return string.format("[[%s:%s|%s]]", nmespace, episodelink, episodetitle)
end
end
return p