Module:Games

local p = {}

local games = { ["AR"] = "All Roads", ["D20"] = "Fallout Pen and Paper d20 creatures", ["FO1"] = "Fallout", ["FO2"] = "Fallout 2", ["FO3"] = "Fallout 3", ["FO3OA"] = "Operation: Anchorage", ["FO3TP"] = "The Pitt", ["FO3BS"] = "Broken Steel", ["FO3PL"] = "Point Lookout", ["FO3MZ"] = "Mothership Zeta", ["FNV"] = "Fallout: New Vegas", ["FNVDM"] = "Dead Money", ["FNVHH"] = "Honest Hearts", ["FNVOWB"] = "Old World Blues", ["FNVLR"] = "Lonesome Road", ["FO4"] = "Fallout 4", ["FOS"] = "Fallout Shelter", ["FOT"] = "Fallout Tactics", ["FOBOS"] = "Fallout: Brotherhood of Steel", ["FOBOS2"] = "Fallout: Brotherhood of Steel 2", ["PA"] = "One Man, and a Crate of Puppets creatures", ["VB"] = "Van Buren" }

function ftrim(str, char) local first = string.sub(str, 1, 1) if first == char then return string.sub(str, 2) else return str end end

function p.links(frame) local result = '' for game in string.gmatch(frame.args[1], '([^,]+)') do       if game == "none" then result = '' else result = result .. '' .. games[ftrim(game, ' ')] .. ' ' end end if result == '' then return '' else return frame:preprocess(string.sub(result, 1, string.len(result) - 5)) end end

function p.title(frame) local result = '' for game in string.gmatch(frame.args[1], '([^,]+)') do       if game == "none" then result = 'Mentioned-only' else result = result .. '' .. games[ftrim(game, ' ')] .. ' / ' end end if result == 'Mentioned-only' then return result else return frame:preprocess(string.sub(result, 1, string.len(result) - 3)) end end

return p