Module:Country

--[[ https://github.com/lukes/ISO-3166-Countries-with-Regional-Codes Description : Gets data about a country Shows some data about a country Syntax :
 * country-isocode (e.g. fr =="France")

]]--

local p = {} local u = require("Dev:Utility") local countryData = require("Module:Sandbox/data") function p.main(frame) local args = u.getArgs(frame) if args then local countryCode = args[1 or "code"] local info = args[2 or "info"] return getCountryData(countryCode,info) end end

function p.countryCode(frame) local args = u.getArgs(frame) if args then local countryCode = args[1 or "name"] local bCloseMatch = args["match"] return getCountryCode(countryCode,bCloseMatch) end end

function getCountryData(code,info) if info and code then return countryData[code][info] end mw.log(code,info) end

function getCountryCode(name, bCloseMatch) name = name:lower for sCode, sData in pairs(countryData) do       sData.name= sData.name:lower if sData.name == name then return sCode end if sData.name:match(name) and bCloseMatch then return sCode end end end

return p