This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing.
This module implements the {{Video game release}} and {{Video game release hlist}} templates. The parameter "format" is passed to Module:List to set the output format. Please see the template page for usage instructions and tracking categories.
require('strict')localgetArgs=require('Module:Arguments').getArgslocalcd=require('Module:CountryData')locallist=require('Module:List');localp={}localknownargs={['format']=true,['class']=true,['style']=true,['list_style']=true,['item_style']=true,['item1_style']=true,['indent']=true}locallabels={['NA']="[[North America|NA]]",['EU']="[[Europe|EU]]",['EUR']="[[Europe|EU]]",['AU']="[[Australasia|AU]]",['AUS']="[[Australasia|AU]]",['PAL']="[[PAL region|PAL]]",['SEA']="[[Southeast Asia|SEA]]",['AS']="[[Asia|AS]]",['SA']="[[South America|SA]]",['OC']="[[Oceania|OC]]",['WW']="<abbr title=\"Worldwide\">WW</abbr>"}localfunctiongetLocalLabel(alias)locallabel=labels[string.upper(alias)]returnlabelendlocalcountryData={};-- Used to store country data to avoid the need of repeated calls to Module:CountryData. This saves a little time if the same abbreviation appears multiple times in the template.localfunctiongetCountryData(frame,alias)localualias=string.upper(alias)if(countryData[ualias]==nil)thenlocalcdtable=cd.gettable(frame,alias,{})countryData[ualias]=cdtable['alias']endreturncountryData[ualias]endlocalfunctionsplitLabel(s)localislist=truelocalres={}fork,vinipairs(mw.text.split(sor'','%s*/%s*'))dolocalv1=v:match('^%s*([A-Z][A-Z][A-Z]?)%s*$')ifv1thentable.insert(res,v1)elselocalv2=v:match('^%s*(%[%[[^%[%]|]*|[A-Z][A-Z][A-Z]?%]%])%s*$')ifv2thentable.insert(res,v2)elseislist=falseendendendreturnislistandresor{s}endfunctionp.main(frame)localargs=getArgs(frame)locallistformat=args['format']if(listformat==nilorlistformat=="")thenlistformat="unbulleted"endlocalitems={}-- Old syntax "Two parameter region" use case, where param 1 is an article, param 2 is a label, and param 3 is the date. We assume this case if argument 4 is nil.if(args[3]~=nilandargs[4]==nil)thenlocalitem="<span style=\"font-size:97%;\">[["if(args[1]~=nil)thenitem=item..args[1]enditem=item.."|"if(args[2]~=nil)thenitem=item..args[2]enditem=item.."]]:</span> "..args[3].."[[Category:Pages using vgrelease with two parameter region]]"table.insert(items,item)-- Old syntax "Blank region" use case, where param 1 is empty, and param 2 is the date.elseif(args[1]==nilandargs[2]~=nil)thenlocalitem=args[2].."[[Category:Pages using vgrelease without a region]]"table.insert(items,item)-- Normal use cases, region/date pairs in 1/2, 3/4, 5/6, etc.elselocali=1localj=2while(args[i]andargs[j])dolocallabels={}fork,vinipairs(splitLabel(args[i]))dolocallabel=getLocalLabel(v);-- Didn't find a local label? Check for country data.if(label==nil)thenifnotv:match('^%s*%[')thenlabel=getCountryData(frame,v)end-- Found something? Build a sitelink with it.if(label~=nil)thenlabel="[["..label.."|"..v.."]]"elselabel=vendendtable.insert(labels,label)endlocalitem="<span style=\"font-size:97%;\">"..table.concat(labels,'/')..":</span> "..args[j]table.insert(items,item)i=i+2j=j+2endend-- Add known parameters of Module:List to the tablefork,vinpairs(args)doif(knownargs[k]==true)thenitems[k]=vendendlocalout=list.makeList(listformat,items)-- Preview message and categorylocalparameterMsg=require('Module:If preview')._warning({'Unknown parameter "_VALUE_".'}).."[[Category:Pages using vgrelease with named parameters|_VALUE_]]"-- Check for invalid parameters fork,vinpairs(args)doif(type(k)~='number'andknownargs[k]~=true)thenlocalmsg=parameterMsg:gsub('_VALUE_',k)out=out..msgendendreturnoutendreturnp