Module:NationNamer: Difference between revisions

From Terra Invicta Official Wiki
Llamageddon (talk | contribs)
m Changed funtion name to start uppercase
Llamageddon (talk | contribs)
Attempt to simplify
Line 14: Line 14:
return 'No such nation name'
return 'No such nation name'
end
end
local retstart = '#REDIRECT [['
local retend = ']]'
-- iconData[iconName][1] is the nation dataName (country code).
-- iconData[iconName][1] is the nation dataName (country code).
return retstart .. nationData[nationName][1] .. retend
return '#REDIRECT [[' .. nationData[nationName][1] .. ']]'
end
end


return p
return p

Revision as of 23:08, 4 December 2025

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

-- For now this is just used by the NationDataNameRedirect template to convert nation displayNames to dataNames
-- Another LUA module to avoid 100+ switch templates

local p = {}

local nationData = mw.loadData( 'Module:NationNamer/dataNames' )

function p.Redirect( frame )
	local nationName = frame.args[1]
	if not nationName then
		return 'No such nation name'	
	end
	if not nationData[nationName] then
		return 'No such nation name'	
	end
	
	-- iconData[iconName][1] is the nation dataName (country code).
	return '#REDIRECT [[' .. nationData[nationName][1] .. ']]'
end

return p