Module:GameFromAbbreviation: Difference between revisions
From Inkipedia, the Splatoon wiki
m (corrected subfunction call) |
m (spaces to tab) |
||
Line 4: | Line 4: | ||
local abbrev = { | local abbrev = { | ||
['OE'] = "Octo Expansion", | |||
['oe'] = "Octo Expansion", | ['oe'] = "Octo Expansion", | ||
['SR'] = "Salmon Run", | |||
['sr'] = "Salmon Run", | |||
['SO'] = "Side Order", | |||
['so'] = "Side Order", | |||
['S'] = "Splatoon", | |||
['s'] = "Splatoon", | |||
['S1'] = "Splatoon", | |||
['s1'] = "Splatoon", | |||
['S2'] = "Splatoon 2", | |||
['s2'] = "Splatoon 2", | |||
['S3'] = "Splatoon 3", | |||
['s3'] = "Splatoon 3", | |||
} | } | ||
Revision as of 14:35, 28 January 2024
Usage
{{GameFromAbbreviation|<game>|<default>}}
game
|
Named or first positional, required | The game's abbreviation (case insensitive). The following abbreviations are handled:
If an invalid abbreviation is used, the | |||
default
|
Named or second positional, optional | If the game argument was not matched, uses this instead. |
See Also
- Module:GameShortened (whom this is a fork of)
local p = {} function p.getFullName(arg, default) local abbrev = { ['OE'] = "Octo Expansion", ['oe'] = "Octo Expansion", ['SR'] = "Salmon Run", ['sr'] = "Salmon Run", ['SO'] = "Side Order", ['so'] = "Side Order", ['S'] = "Splatoon", ['s'] = "Splatoon", ['S1'] = "Splatoon", ['s1'] = "Splatoon", ['S2'] = "Splatoon 2", ['s2'] = "Splatoon 2", ['S3'] = "Splatoon 3", ['s3'] = "Splatoon 3", } -- return the full name from the game arg. -- If arg is nil then a default or "Splatoon" (whichever is non-nil first) will be used. return abbrev[arg] or default or "Splatoon" end -- main to extract arg from frame function p.main(frame) local args = frame:getParent().args local arg = args['game'] or args[1] local default = args['default'] or args[2] -- or nil return p.getFullName(arg, default) end return p --Forked from Module:GameShortened (by Slate)