localmArguments--initialize lazilylocalmHatList=require('Module:Hatnote list')localmHatnote=require('Module:Hatnote')localmOtheruses=require('Module:Other uses')localyesNo=require('Module:Yesno')localp={}functionp.otherusesof(frame)mArguments=require('Module:Arguments')returnp._otherusesof(mArguments.getArgs(frame))endfunctionp._otherusesof(args)localcurrentTitle=mw.title.getCurrentTitle()localprefixedText=currentTitle.prefixedTextlocalmaxArg=0fork,vinpairs(args)doiftype(k)=='number'andk>maxArgthenmaxArg=kendendlocalpage=args[maxArg]ifmaxArg==1thenpage=mHatnote.disambiguate(page)endlocalofWhat=nilifmaxArg>2thenlocalpages={}localmidPages={}fork,vinpairs(args)doiftype(k)=='number'andk<maxArgthenmidPages[k]=mHatnote.quote(v)endendfori=1,maxArgdoifmidPages[i]thenpages[#pages+1]=midPages[i]endendofWhat=mHatList.orList(pages)endifnotofWhatthenofWhat=mHatnote.quote(args[1]orprefixedText)endlocaloptions={title=ofWhat,otherText=args.topicandstring.format('uses of %s in %s',ofWhat,args.topic)orstring.format('uses of %s',ofWhat)}localskipCat=(currentTitle.isTalkPageor(currentTitle.namespace==2))or(yesNo(args.category)==false)localoddCat=skipCatand''or"[[Category:Hatnote templates using unusual parameters]]"if(mw.ustring.lower(args[1]or"")==mw.ustring.lower(prefixedText))andmaxArg<=2or((notargs[1])and(notargs[2]))thenoptions.otherText=options.otherText..oddCatendarg=pageand{page}or{}returnmOtheruses._otheruses(arg,options)endreturnp