[Lesen | Bearbeiten | Versionen | Aktualisieren] DokumentationSpringe zum Quelltext ↴ Zum Gebrauch von Lua-Modulen siehe die Modul-Hilfe.
Das Modul Symbolleiste stellt die Funktion bar zur Verfügung, die eine Symbolleiste anzeigt, z.B. die Hungerleiste.
Aufruf
Die Parameter des Aufrufers werden automatisch übergeben. Das sind:
für {{#invoke:Symbolleiste|bar}}
siehe Vorlage:Symbolleiste
Anwendung
Liste der Vorlagen, die dieses Modul verwenden
Spiel-Symbole |
| ||||||
---|---|---|---|---|---|---|---|
Spiel-Grafiken | |||||||
Wiki-Grafiken | |||||||
Module |
| ||||||
Hilfsmodule |
local p = {}
function p.bar( f )
local args = require( 'Modul:ParameterUmwandeln' ).merge()
local full = args.full or ''
local half = args.half or 'Half ' .. full
local empty = args.empty or 'Empty ' .. full
local value = math.abs( tonumber( args.value ) or 0 ) / 2
local min = math.ceil( math.abs( tonumber( args.min ) or 0 ) / 2 )
local size = args.size or ''
local title = args.title or ''
local reverse = args.reverse or ''
local link = args.link or ''
local alt = args.alt or ''
if title:lower() == 'none' then
title = ''
elseif title ~= '' then
title = ' title="' .. title .. '"'
else
title = ' title="' .. value .. '"'
end
local fullIcon = ''
local halfIcon = ''
local emptyIcon = ''
if link ~= '' and link:lower() ~= 'none' then
link = '|link=' .. link
else
link = ''
end
if alt ~= '' then
alt = '|alt=' .. alt
else
alt = ''
end
if tonumber( size ) then
size = '|' .. size .. 'px'
elseif size ~= '' then
size = '|' .. size
end
if value == 0 then
emptyIcon = '[[Datei:' .. empty .. size .. link .. alt .. ']]'
else
fullIcon = string.rep( '[[Datei:' .. full .. size .. link .. alt .. ']]', math.floor( value ) )
if math.floor( value ) ~= value then
halfIcon = '[[Datei:' .. half .. size .. link .. alt .. ']]'
end
end
if min - value >= 1 then
emptyIcon = string.rep( '[[Datei:' .. empty .. size .. link .. alt .. ']]', min - math.ceil( value ) )
end
if reverse ~= '' then
return '<span class="nowrap pixel-image"' .. title .. '>' .. emptyIcon .. halfIcon .. fullIcon .. '</span>'
else
return '<span class="nowrap pixel-image"' .. title .. '>' .. fullIcon .. halfIcon .. emptyIcon .. '</span>'
end
end
return p