VOOZH about

URL: https://minecraft.wiki/w/Module:Version_link

⇱ Module:Version link – Minecraft Wiki


Module:Version link

From Minecraft Wiki
Jump to navigation Jump to search
Documentation[view] [edit] [history] [purge]Jump to code ↴

Usage

This module implements {{Version link}}.

[view] [edit] [history] [purge]The above documentation is transcluded from Module:Version link/doc.
localp={}
localfunctionremovePrefix(s,prefixes)
localfinal=s
for_,pinipairs(prefixes)do
final=final:gsub('^'..p,'')
end
returnmw.text.trim(final)
end
localfunctiongetLast(prefix)
returnfunction(s)
locallast=mw.ustring.match(s,'^.+%s+(%S+)$')
returnprefix..last
end
end
localfunctiongetJava(s)
return'Java Edition '..removePrefix(s,{'[Jj]ava',' [Ee]dition','[Jj][Ee]'})
end
localfunctiongetBedrock(s)
return'Bedrock Edition '..removePrefix(s,{'[Bb]edrock',' [Ee]dition','[Bb][Ee]'})
end
localfunctiongetPocket(s)
if(s:match('Alpha')andnots:match('Realms'))then
return'Pocket Edition '..mw.getCurrentFrame():callParserFunction('#dplreplace',s,'/^(pocket edition|pocket|pe) (Alpha)? ?v?(\\d+\\.\\d+\\.\\d+)? ?(build \\d+)?/i','v\\3 alpha \\4')
end
return'Pocket Edition '..removePrefix(s,{'[Pp]ocket',' [Ee]dition','[Pp][Ee]'})
end
localfunctiongetEducation(s)
return'Minecraft Education '..removePrefix(s,{'[Ee]ducation',' [Ee]dition','[Ee][Dd][Uu]','[Ee][Ee]'})
end
localfunctiongetChinese()
return'China Edition#History'
end
localfunctiongetLauncher(s)
return'Minecraft launcher#'..removePrefix(s,{'[Ll]auncher'})
end
localfunctiongetPlayStation(s)
returnremovePrefix(s,{'[Pp]layStation','[Pp][Ss]'})..'#Legacy Console Edition'
end
localprefixFunctions={
java=getJava,
je=getJava,
['pre-classic']=getJava,
classic=getJava,
indev=getJava,
infdev=getJava,
alpha=getJava,
beta=getJava,
pe=getPocket,
pocket=getPocket,
be=getBedrock,
bedrock=getBedrock,
edu=getEducation,
education=getEducation,
ee=getEducation,
china=getChinese,
chinese=getChinese,
launcher=getLauncher,
earth=getLast('Earth:'),
dungeons=getLast('Dungeons:'),
['dungeons arcade']=getLast('Dungeons:'),
legends=getLast('Legends:'),
realms=getLast('Realms#'),
['360']=getLast('Xbox 360 Edition '),
xbox360=getLast('Xbox 360 Edition '),
xbone=getLast('Xbox One Edition '),
xb1=getLast('Xbox One Edition '),
xbox1=getLast('Xbox One Edition '),
ps=getPlayStation,
ps3=getLast('PlayStation 3 Edition '),
ps4=getLast('PlayStation 4 Edition '),
playstation=getLast('PlayStation 4 Edition '),
psv=getLast('PlayStation Vita Edition '),
psvita=getLast('PlayStation Vita Edition '),
wii=getLast('Wii U Edition Patch '),
wiiu=getLast('Wii U Edition Patch '),
switch=getLast('Nintendo Switch Edition '),
nswitch=getLast('Nintendo Switch Edition '),
['3ds']=getLast('New Nintendo 3DS Edition '),
new=getLast('New Nintendo 3DS Edition '),
new3ds=getLast('New Nintendo 3DS Edition '),
minecraftedu=getLast('MinecraftEdu '),
launcher=getLast('Launcher '),
}
functionp.version(s)
localv=s:gsub('^[Mm]inecraft ','')
localprefix=mw.text.split(v,'%s')[1]:lower()
localfunc=prefixFunctions[prefix]
iffuncthen
returnfunc(v)
else
returnv
end
end
functionp.main(f)
localargs=f
iff==mw.getCurrentFrame()then
args=require([[Module:ProcessArgs]]).merge(false)
end
localtext
ifargs[2]==''then
text=mw.ustring.match(args[1],'^.+%s+(%S+)$')
else
text=args[2]orargs[1]
end
return'[['..p.version(args[1])..'|'..text..']]'
end
returnp
Retrieved from "https://minecraft.wiki/w/Module:Version_link?oldid=3093826"

Navigation menu