localgetArgs=require('Module:Arguments').getArgslocaldata=mw.loadData('Module:HK-MTR stations/data')localp={}localfunctionmakeInvokeFunction(funcName)-- makes a function that can be returned from #invoke, using-- [[Module:Arguments]].returnfunction(frame)localargs=getArgs(frame,{parentOnly=true})returnp[funcName](args)endendp.station=makeInvokeFunction('_station')localfunctionerrorText(message)return'<strong class="error">'..message..'</strong>'endlocalfunctiongetStation(code)localstation=data.stations[code]ifnotstationthenlocalalias=data.aliases[code]ifaliasthencode=aliasstation=data.stations[code]endend-- The returned code is what should be used (target of any alias).returnstation,codeendfunctionp._station(args)localcode=args[1]orargs.station-- arguments have been trimmedifcode==nilorcode==''thenreturnerrorText('Need station or stop name')endlocalstation,code=getStation(code)locallink,text,resultifstationthenifstation.link==nilthenreturnstation.textelselink=station.linkorcodeendtext=station.textorcodeelselink=code..' Stop'text=codeendresult='[['..link..'|'..text..']]'returnresultendreturnp