Difference between revisions of "Module: Calculations Ages"

From A Wiki of Ice and Fire
Jump to: navigation, search
(Created page with "local getArgs = require('Module:Arguments').getArgs local p = {} function p.main(frame) local args = getArgs(frame) local name = args[1] local key = mw.ustring.lower(name...")
 
 
Line 6: Line 6:
 
local args = getArgs(frame)
 
local args = getArgs(frame)
 
local name = args[1]
 
local name = args[1]
local key = mw.ustring.lower(name)
 
 
local page
 
local page
if mw.ustring.match(key, "^[A-Da-d]") ~= nil then
+
if mw.ustring.match(name, "^[A-Da-d]") ~= nil then
 
page = "Years after Aegon's Conquest/Calculations Ages"
 
page = "Years after Aegon's Conquest/Calculations Ages"
elseif mw.ustring.match(key, "^[E-Je-j]") ~= nil then
+
elseif mw.ustring.match(name, "^[E-Je-j]") ~= nil then
 
page = "Years after Aegon's Conquest/Calculations Ages (Continued)"
 
page = "Years after Aegon's Conquest/Calculations Ages (Continued)"
elseif mw.ustring.match(key, "^[K-Qk-q]") ~= nil then
+
elseif mw.ustring.match(name, "^[K-Qk-q]") ~= nil then
 
page = "Years after Aegon's Conquest/Calculations Ages (Continued2)"
 
page = "Years after Aegon's Conquest/Calculations Ages (Continued2)"
elseif mw.ustring.match(key, "^[R-Zr-z]") ~= nil then
+
elseif mw.ustring.match(name, "^[R-Zr-z]") ~= nil then
 
page = "Years after Aegon's Conquest/Calculations Ages (Continued3)"
 
page = "Years after Aegon's Conquest/Calculations Ages (Continued3)"
 
else
 
else

Latest revision as of 23:53, 1 December 2022

Documentation for this module may be created at Module:Calculations Ages/doc

local getArgs = require('Module:Arguments').getArgs

local p = {}

function p.main(frame)
	local args = getArgs(frame)
	local name = args[1]
	local page
	if mw.ustring.match(name, "^[A-Da-d]") ~= nil then
		page = "Years after Aegon's Conquest/Calculations Ages"
	elseif mw.ustring.match(name, "^[E-Je-j]") ~= nil then
		page = "Years after Aegon's Conquest/Calculations Ages (Continued)"
	elseif mw.ustring.match(name, "^[K-Qk-q]") ~= nil then
		page = "Years after Aegon's Conquest/Calculations Ages (Continued2)"
	elseif mw.ustring.match(name, "^[R-Zr-z]") ~= nil then
		page = "Years after Aegon's Conquest/Calculations Ages (Continued3)"
	else
		error("Name '" .. name .. "' invalid, must start with a letter.")
	end
	return page .. "#" .. name
end

return p