Difference between revisions of "Module:Symphogear"

From Symphogear Wiki
Jump to: navigation, search
(Created page with "local symphogear = {} -- used as the base name for all Symphogear seasons local baseNameJP = "戦姫絶唱シンフォギア" local baseNameLocal = "Senki Zesshou Symphogear"...")
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
local symphogear = {}
 
local symphogear = {}
-- used as the base name for all Symphogear seasons
 
local baseNameJP = "戦姫絶唱シンフォギア"
 
local baseNameLocal = "Senki Zesshou Symphogear"
 
-- important to keep track of number of seasons for informative errors
 
local seasonCount = 5
 
local seasonsJP = {baseNameJP, baseNameJP.."G", baseNameJP.."GX", baseNameJP.."AXZ", baseNameJP.."XV"}
 
local seasonsLocal = {baseNameLocal, baseNameLocal.." G", baseNameLocal.." GX", baseNameLocal.." AXZ", baseNameLocal.." XV"}
 
-- likewise keep counts updated as updating shit
 
local seasonsWithEpisodes = 4
 
local episodeCounts = {13, 13, 13, 13}
 
local episodesJP = {
 
{},
 
{},
 
{},
 
{}
 
}
 
local episodesLocal = {
 
{},
 
{},
 
{},
 
{}
 
}
 
   
 
-- stuff under this line is what the program actually calls to pull those arrays
 
-- stuff under this line is what the program actually calls to pull those arrays
   
 
function symphogear.season (frame)
 
function symphogear.season (frame)
  +
local data = mw.loadData("Module:Symphogear/data")
assert(frame.season <= seasons and frame.season > 0,"Invalid season number.")
 
return seasonsLocal[frame.season]
+
local season = tonumber(frame.args.season)
  +
assert(season <= data.seasonCount and season > 0,"Invalid season number.")
  +
return data.seasonsLocal[season]
 
end
 
end
   
 
function symphogear.seasonJP (frame)
 
function symphogear.seasonJP (frame)
  +
local data = mw.loadData("Module:Symphogear/data")
assert(frame.season <= seasons and frame.season > 0,"Invalid season number.")
 
return seasonsJP[frame.season]
+
local season = tonumber(frame.args.season)
  +
assert(season <= data.seasonCount and season > 0,"Invalid season number.")
  +
return data.seasonsJP[season]
 
end
 
end
   
 
function symphogear.episode (frame)
 
function symphogear.episode (frame)
  +
local data = mw.loadData("Module:Symphogear/data")
assert(frame.season <= seasonsWithEpisodes and frame.season > 0,"Invalid season number.")
 
  +
local season = tonumber(frame.args.season)
assert(frame.episode <= episodeCounts[frame.season] and frame.episode > 0,"Invalid episode number.")
 
return episodesLocal[frame.season][frame.episode]
+
local episode = tonumber(frame.args.episode)
  +
assert(season <= data.seasonsWithEpisodes and season > 0,"Invalid season number.")
  +
assert(episode <= data.episodeCounts[season] and episode > 0,"Invalid episode number.")
  +
return data.episodesLocal[season][episode]
 
end
 
end
   
 
function symphogear.episodeJP (frame)
 
function symphogear.episodeJP (frame)
  +
local data = mw.loadData("Module:Symphogear/data")
assert(frame.season <= seasonsWithEpisodes and frame.season > 0,"Invalid season number.")
 
  +
local season = tonumber(frame.args.season)
assert(frame.episode <= episodeCounts[frame.season] and frame.episode > 0,"Invalid episode number.")
 
return episodesJP[frame.season][frame.episode]
+
local episode = tonumber(frame.args.episode)
  +
assert(season <= data.seasonsWithEpisodes and season > 0,"Invalid season number.")
  +
assert(episode <= data.episodeCounts[season] and episode > 0,"Invalid episode number.")
  +
return data.episodesJP[season][episode]
 
end
 
end
   

Latest revision as of 10:44, 13 June 2018

Gives access to standardised names for seasons and episodes, as well as easy access to the Japanese names.