Aller au contenu

« Module:Localisations » : différence entre les versions

335 octets ajoutés ,  23 août 2022
Programmation défensive
mAucun résumé des modifications
(Programmation défensive)
Ligne 56 : Ligne 56 :
then local pokemon_without_form = mw.ustring.gsub(pokemon, replacing, "")
then local pokemon_without_form = mw.ustring.gsub(pokemon, replacing, "")
local form = replaced
local form = replaced
pokemon_type = data_types[pokemon_without_form][form][1]
local pokemon_types = data_types[pokemon_without_form]
if pokemon_types
then local pokemon_types_form = pokemon_types[form]
if pokemon_types_form
then pokemon_type = pokemon_types_form[1]
else pokemon_type = pokemon_types[1][1]
end
else pokemon_type = ""
end
break
break
end
end
end
end
if not pokemon_type
if not pokemon_type
then pokemon_type = data_types[pokemon][1][1]
then local pokemon_types = data_types[pokemon]
if pokemon_types
then pokemon_type = pokemon_types[1][1]
else pokemon_type = ""
end
end
end
end
end