Przejdź do zawartości

Moduł:Brudnopis/Haifisch7734/Test

Z Wikipedii, wolnej encyklopedii

Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:Brudnopis/Haifisch7734/Test/opis

local module = {};

function module.testSplit(frame)
	local stringToBeSplitted = string.gsub(frame.args[1], "}}{{", "}}#{{", 2);
	local t={} ; i=1;
	for str in string.gmatch(stringToBeSplitted, "([^".."#".."]+)") do
    	t[i] = str;
        i = i + 1;
    end
    return t[2];
end

function module.add(frame)
	return tonumber(frame.args[1]) + tonumber(frame.args[2]);
end

function module.punktacja(frame)
	local rok = tonumber(frame.args[1]);
	if rok < 1960 then
		return 1
	elseif rok < 2003 then
		return 2
	elseif rok < 2010 then
		return 3
	else
		return 4
	end
end

function module.ekstrakcjaPozycji(frame)
	local pozycja = frame.args[1];
	local sparsowanaPozycja = string.match(pozycja, '%d+', 1)
	if sparsowanaPozycja ~= nil then
		return sparsowanaPozycja
	else
		if string.match(pozycja, 'NZ', 1) == 'NZ' then
			return 'NZ'
		elseif string.match(pozycja, 'NPK', 1) == 'NPK' then
			return 'NPK'
		elseif string.match(pozycja, 'NU', 1) == 'NU' then
			return 'NU'
		elseif string.match(pozycja, 'NS', 1) == 'NS' then
			return 'NS'
		elseif string.match(pozycja, 'DK', 1) == 'DK' then
			return 'DK'
		elseif string.match(pozycja, 'EX', 1) == 'EX' then
			return 'EX'
		elseif string.match(pozycja, 'NW', 1) == 'NW' then
			return 'NW'
		elseif string.match(pozycja, 'WD', 1) == 'WD' then
			return 'WD'
		elseif string.match(pozycja, 'INJ', 1) == 'INJ' then
			return 'INJ'
		elseif string.match(pozycja, '–', 1) == '–' then
			return '–'
		elseif string.match(pozycja, '-', 1) == '-' then
			return '–'
		else
			return ' '
		end
	end
end

return module;