« Module:Country data » : différence entre les versions

De Lagny-sur-Marne Wiki
Aller à la navigation Aller à la recherche
0x010D (discussion | contributions)
Aucun résumé des modifications
0x010D (discussion | contributions)
Aucun résumé des modifications
Ligne 13 : Ligne 13 :


function p.standarddisplay(country, typeval)
function p.standarddisplay(country, typeval)
 
local modul = modulelist[string.lower(country or '')]
country = string.lower(country.args[1])
local modul = modulelist[country]
if not modul then return
if not modul then return
country
country

Version du 15 janvier 2015 à 10:41

local p = {} local modulelist = mw.loadData('Module:Country data/liste')

local function getval(info, param, data) -- info== name, flag, etc. -- param = ancient, default, etc. -- data = table module with the data if type(data[info]) == 'string' then return data[info] end return data[info][param] end

function p.standarddisplay(country, typeval) local modul = modulelist[string.lower(country or )] if not modul then return country end if not typeval then typeval = "default" end local data = require('Module:Country data/' .. modul) local function get(what) return getval(what, typeval, data) end local name = get('name') local link = get('link') local flag = get('flag')

if flag then flag = '' .. '22x20px' else flag = end return flag .. ' ' .. name .. '' end return p