Module:GameShortened
Helper template that transforms the game argument into the shortened S form. For template chaining and code reduction. Will also help us when new game/expansions/formats are created.
If the game is not matched, the default argument is used instead if specified, otherwise "S".
Usage
game
|
Named or first positional, optional | The game that the cost belongs to. The following values are handled:
If game is not specified, the default argument will be used instead. | |||
default
|
Named or second positional, optional | If the game argument was not matched, uses this instead.
|
- Typical usage
{{GameShortened|<game>|<default>}}
{{GameShortened|Octo Expansion}}
->
Script error: The module returned a function value. It is supposed to return an export table.
- Chained in another template that has the game parameter
{{GameShortened|{{{game|}}}}}
->
Script error: The module returned a function value. It is supposed to return an export table.
- Using the default parameter
{{GameShortened|Splatoon 3|S}}
->
Script error: The module returned a function value. It is supposed to return an export table.
{{GameShortened|game=Splatoon 2|default=Splatoon}}
->
Script error: The module returned a function value. It is supposed to return an export table.
- In files
[[File:{{GameShortened|Splatoon 3}}_Icon_Big_Run.svg|link=Big Run|30px]]
->
[[File:Script error: The module returned a function value. It is supposed to return an export table._Icon_Big_Run.svg|link=Big Run|30px]]
[[File:{{GameShortened|game=Splatoon 2|default=Splatoon 3}}_Splatfest_Logo.svg|link=Splatfest|30px]]
->
[[File:Script error: The module returned a function value. It is supposed to return an export table._Splatfest_Logo.svg|link=Splatfest|30px]]
See Also
return function (game, default) if game == "Octo Expansion" or game == "OE" then return "OE" elseif game == "Splatoon" or game == "Splatoon 1" or game == "S" then return "S" elseif game == "Splatoon 2" or game == "S2" then return "S2" elseif game == "Splatoon 3" or game == "S3" then return "S3" else return default or "S" end end