Module:Check for unknown parameters

Documentation for this module may be created at Module:Check for unknown parameters/doc

-- This module may be used to compare the arguments passed to the parent-- with a list of arguments, returning a specified result if an argument is-- not on the listlocal p = {}function p.check (frame)local args = frame.argslocal pargs = frame:getParent().argslocal knownargs = {}local unknown = 'Found _VALUE_, 'local res = {}-- create the list of known args, and the return stringfor k, v in pairs(args) doif type(k) == 'number' thenv = mw.ustring.gsub(v, '^%s*(.-)%s*$', '%1')knownargs[v] = 1elseif (k == 'unknown' and type(v) == 'string') thenunknown = vendendend-- loop over the parent args, and make sure they are on the listfor k,v in pairs(pargs) doif (knownargs[k] == nil and type(k) == 'string') thenk = mw.ustring.gsub(k, '[^%w\-_ ]', '?')local r = mw.ustring.gsub(unknown, '_VALUE_', k)table.insert(res, r)endendreturn table.concat(res)endreturn p
🔥 Top keywords: Ikhasi ElikhuluIzinyanga zonyaka ngesiZuluSpecial:SearchIsichazamazwiUkuhloniphisa (Zulu Euphemism)IVilnyusiImfundoXHamsterTalk:Ikhasi ElikhuluIkhambi lokugomaUmakhalekhukhwiniTrue Jesus ChurchIzinganekwaneIYurophuBaike: Umnyango wamgwamandaIntabaUser:GerardM/Members of the National Assembly of KenyaIbhubesiIJaphaniUser:GerardM/Members of the Parliament of GhanaInjaIGrekiI-OstreliyaISpeyiniUNelson MandelaIRiphabhuliki yaseNingizimu AfrikaI-AngolaCategory:IYurophuIPolandiIMpumalanga KapaILondonIsiQumuqumuUser talk:DeborahjayUser:GerardM/Ministers of Finance of Ivory CoastINtshonalanga KapaUser:GerardM/Municipalities of AlgeriaCuritibaIKwaZulu-NataliUser:GerardM/Fellows of the African Academy of SciencesUser:GerardM/Communes of NigerUser:GerardM/Wards of TanzaniaCategory:Izilimi zaseNingizimu AfrikaIzifundazwe zaseNingizimu AfrikaIFuleyisitataUser:GerardM/Gambian universities et alUNochokoUser:GerardM/Egyptian universities et alIThekuUser:GerardM/South African Young Academy of ScienceINokiUser:GerardM/Zambian universities et alUser:GerardM/Tunesian universities et alINyakatho KapaUbuntuIKapaUser:GerardM/Members of the Senate of NigeriaDinganeUser talk:Fiso.dlaminiIThanzaniyaUMasingana (uJanuwari)IMekisikoCategory:IJalimaniUNkulunkuluNelson MandelaUser:GerardM/Ethiopian universities et alI-EshiyaI-YouTubeUNokhweziUser:GerardM/Rwandan universities et alUCansiUser:GerardM/Members of the Academy of Science of South AfricaIzitayela zocansiUser:GerardM/Prime Ministers of Burkina FasoIsiCikiziIMelika EningizimuUbuciko bomlomoUmchazamkhathiIsidakamizwaUser:GerardM/Ministers of Foreign Affairs of Ethiopia18845 ngoLweziUphiko Lwezilimi KuzwelonkeBaike: General disclaimerIntufeshePeruJohn F. KennedyUNhlolanja (uFebhuwari)InkalankalaINkabazwe GiniI-AyisilandiUser:GerardM/Presidents of the ComorosCategory talk:IzihlokoUZibandlela (uDisemba)User:GerardM/Members of the National Assembly of GuineaGeorge W. BushUMbasa (u-Ephreli)IsiTaliyaI-AfganistaniUser:GerardM/Municipalities of Cape Verde