Module:Sandbox/PHansen/Fteam

local p = {}

-- Feb-2015
 * Module:Sandbox/PHansen/Fteam --- User:PHansen/Fteam ---
 * 'Fteam' : F for Football (soccer) --- team: national teams for adults and youths (21, 19, 17) -  men and women
 * Intention : to replace separate templates with one 'Fm/k/u' via Lua-module - short form : 'Fmku' (men/women/youth)

function p.main ( frame ) --

local country = frame.args[1] -- parameter from the template : country local sex    = frame.args[2] -- parameter from the template : male or female  : m or k local age     = frame.args[3] -- parameter from the template : 21, 19, 17, or ? - national team, youth

local return_result = "" local dummy = "dummy" local error_msg = ' The format is &#123;{Fteam|country|sex|age}} '

--Error if country == nil or country == "" or country == "m" or country == "k" or country == "[0-9]" then return ( error_msg .. ' - `country` must be first parameter' ) end -- error if no country

-- if 'country' seemed OK then continue: -- men AND adults (no age given) if sex == "m" and age == "" then -- was: s fodboldlandshold return_result = "" .. country .. "" return return_result end -- adult, men

-- women AND adults (no age given) if sex == "k" and age == "" then --was: s kvindefodboldlandshold return_result = "" .. country .. "" return return_result end -- adult, women

-- men AND youth (age given 17, 19, 21, or ?) if age ~= "" and sex == "m" then -- was: U/ return_result = "" .. country .. " U/" .. age .. "" return return_result end -- men AND youth (age given 17, 19, 21, or ?)

-- women AND youth (age given 17, 19, 21, or ?) if age ~= "" and sex == "k" then -- was: U/ return_result = "" .. country .. " U/" .. age .. "" return return_result end -- women AND youth (age given 17, 19, 21, or ?)

end -- function p.main ( frame )

return p -- export table