Moduł:Wskaźnik: Różnice pomiędzy wersjami

Z Minecraft Wiki Polska
Przejdź do nawigacji Przejdź do wyszukiwania
[wersja przejrzana][wersja przejrzana]
d poprawka (zamiana liczby na tekst)
poprawki modułu (usprawniono podstawianie wartości wskutek wyodrębnienia wewnętrznej funkcji "give")
Linia 1: Linia 1:
local p = {}
local p = {}
function give(frame, key)
local result = mw.text.trim(frame.args[key] or '')
return #result > 0 and result or nil
end
function p.indicator(frame)
function p.indicator(frame)
local file = frame.args['file']
local file = give(frame, 'file')
if not file or file == '{{{1}}}.png|32px|{{{1}}}|link=|alt={{{1}}}' then
if not file or file == '{{{1}}}.png|32px|{{{1}}}|link=|alt={{{1}}}' then
error('file')
error('file')
Linia 11: Linia 15:
args =
args =
{
{
name = frame.args['name'] or tostring(os.time())
name = give(frame, 'name') or tostring(os.time())
}
}
}
}

Wersja z 23:09, 29 maj 2025

[ utwórz | historia | odśwież ]Dokumentacja
W tym module nie ma dokumentacji. Jeśli wiesz jak używać tego modułu, proszę, podaj odpowiednie informacje.
local p = {}
function give(frame, key)
	local result = mw.text.trim(frame.args[key] or '')
	return #result > 0 and result or nil
end
function p.indicator(frame)
	local file = give(frame, 'file')
	if not file or file == '{{{1}}}.png|32px|{{{1}}}|link=|alt={{{1}}}' then
		error('file')
	else
		frame:extensionTag
		{
			name = 'indicator',
			content = '[[Plik:'..file..']]',
			args =
			{
				name = give(frame, 'name') or tostring(os.time())
			}
		}
	end
end
return p