Module:NationNamer: Difference between revisions

From Terra Invicta Official Wiki
Llamageddon (talk | contribs)
mNo edit summary
Llamageddon (talk | contribs)
mNo edit summary
Line 21: Line 21:
function p.Test(frame)
function p.Test(frame)
local testName = frame.args[1]
local testName = frame.args[1]
return 'Test = ' .. testName
return 'Test = [[' .. testName ']]'
end
end



Revision as of 23:53, 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

function p.Test(frame)
	local testName = frame.args[1]
	return 'Test = [[' .. testName ']]'
end

function p.Test2(frame)
	local test2Name = frame.args[1]
	return 'Test 2 = <pre>#REDIRECT [[' .. nationData[test2Name][1] .. ']]</pre>'
end

function p.Test3(frame)
	local nationName = frame.args[1]
	return '#REDIRECT [[' .. nationData[nationName][1] .. ']]'
end

return p