localexport={}-- index_limit: parameters larger than this can't be specified as numbered-- parameters. This is so that invocations of {{ifmatch}} like the following work:-- {{ifmatch|s|pattern|if_true|if_false}}functionexport._getParameters(frame_args,arg_list,index_limit)localnew_args={};localindex=1;localvalue;for_,arginipairs(arg_list)dovalue=frame_args[arg]ifvalue==nilandindex<=index_limitthenvalue=frame_args[index];index=index+1;endnew_args[arg]=value;endreturnnew_args;endfunctionexport.ifmatch_helper(frame)localnew_args=export._getParameters(frame:getParent().args,{'s','pattern','start','plain','unicode'},2)locals=assert(new_args.s)localpattern=assert(new_args.pattern)localstart=new_args.startandmath.floor(assert(tonumber(newargs.start),"start should be a number"))or1localyesno=require('Module:yesno')localplain=yesno(new_args.plain)localunicode=new_args.unicodeifunicodethenunicode=yesno(unicode)elseunicode=trueend-- If plain is true, mw.ustring.find behaves like string.find and there is-- no point in potentially slowing down matching by using mw.ustring.find.ifplainthenunicode=falseendlocalfind=unicodeandmw.ustring.findorstring.findreturnfind(s,pattern,start,plain)and'1'or''endreturnexport