Moduł:Inventory slot/Furnace: Różnice pomiędzy wersjami

Z Minecraft Wiki Polska
Przejdź do nawigacji Przejdź do wyszukiwania
[wersja nieprzejrzana][wersja nieprzejrzana]
d poprawka
d Od teraz moduł obsługuje wszystkie wersje dokumentacji
Linia 3: Linia 3:
local str = data.args[1]
local str = data.args[1]
local num = data.args[2]
local num = data.args[2]
if string.find(';') and num == "" then
return str
end
str = string.gsub(str,',',';')
str = string.gsub(str,',',';')

Wersja z 08:04, 9 kwi 2021

[ 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 p.grid( data )
	local str = data.args[1]
	local num = data.args[2]
	if string.find(';') and num == "" then
		return str
	end
	str = string.gsub(str,',',';')
	
	local result = ""
	local strPos = 1
	local numPos = 1
	if num ~= "" then
		while string.find(num,',',numPos) do
			result = result..string.sub(str,strPos,string.find(str,';',strPos) - 1)..','
			strPos = string.find(str,';',strPos) + 1
			result = result..string.sub(num,numPos,string.find(num,',',numPos) - 1)..';'
			numPos = string.find(num,',',numPos) + 1
		end
	end
	local ended = false
	if string.find(str,';',strPos) then
		if num ~= "" then
			result = result..string.sub(str,strPos,string.find(str,';',strPos) - 1)..','..string.sub(num,numPos,-1)..';'
			strPos = string.find(str,';',strPos) + 1
			ended = true
		end
	end
	result = result..string.sub(str,strPos,-1)
	if ended == false then
		result = result..','..string.sub(num,numPos,-1)
	end
	return result
end
return p