« Module:Infobox/Objet/Note » : différence entre les versions

De Starfield Wiki
Page créée avec « local general = require("Module:Infobox/Fonctions") local localdata = require("Module:Infobox/Localdata") -- Support de la note (par défaut : tablette) medium = function(localdata) local medium = localdata["support"] or "tablette" local MEDIUMS = { tablette = {"Tablette", "SF Tablette.png"}, } local medium_config = MEDIUMS[medium:lower()] if family_config == nil then error(string.format( "Valeur inconnue du paramètre « support » : « %s »", m... »
 
retouche de la modification précédente
 
(4 versions intermédiaires par 2 utilisateurs non affichées)
Ligne 7 : Ligne 7 :
local MEDIUMS = {
local MEDIUMS = {
tablette = {"Tablette", "SF Tablette.png"},
tablette = {"Tablette", "SF Tablette.png"},
livre = {"Livre", "Livre.png"},
}
}
local medium_config = MEDIUMS[medium:lower()]
local medium_config = MEDIUMS[medium:lower()]
if family_config == nil then
if medium_config == nil then
error(string.format(
error(string.format(
"Valeur inconnue du paramètre « support » : « %s »",
"Valeur inconnue du paramètre « support » : « %s »",
Ligne 17 : Ligne 18 :
return string.format(
return string.format(
"[[Fichier:%s|x25px|alt=|link=|class=notpageimage]] %s",
"[[Fichier:%s|x25px|alt=|link=|class=notpageimage]] %s",
medium_config[1],
medium_config[2],
medium_config[2]
medium_config[1]
)
)
end
end
Ligne 31 : Ligne 32 :
             rows = {
             rows = {
                 {type = "row", label = "Support", value = medium},
                 {type = "row", label = "Support", value = medium},
                 {type = "row", label = "Localisation", value = "localisation"},
                 {type = "row", label = "Emplacement", value = "emplacement"},
                {type = "row", label = "Valeur", value = "valeur"},
                {type = "row", label = "Masse", value = "masse"},
             },
             },
         },
         },

Dernière version du 29 novembre 2023 à 18:52

Documentation[voir] [modifier] [purger]
local general = require("Module:Infobox/Fonctions")
local localdata = require("Module:Infobox/Localdata")

-- Support de la note (par défaut : tablette)
medium = function(localdata)
	local medium = localdata["support"] or "tablette"
	local MEDIUMS = {
		tablette = {"Tablette", "SF Tablette.png"},
		livre = {"Livre", "Livre.png"},
	}
	local medium_config = MEDIUMS[medium:lower()]
	if medium_config == nil then
		error(string.format(
			"Valeur inconnue du paramètre « support » : « %s »",
			medium
		))
	end
	return string.format(
		"[[Fichier:%s|x25px|alt=|link=|class=notpageimage]] %s",
		medium_config[2],
		medium_config[1]
	)
end

return {
    parts = {
        general.title(),
        general.image(),
        {
            type = "table",
            separator = true,
            rows = {
                {type = "row", label = "Support", value = medium},
                {type = "row", label = "Emplacement", value = "emplacement"},
                {type = "row", label = "Valeur", value = "valeur"},
                {type = "row", label = "Masse", value = "masse"},
            },
        },
        general.creation_kit(),
    }
}