Moduł:Inventory slot/Furnace: Różnice pomiędzy wersjami
Przejdź do nawigacji
Przejdź do wyszukiwania
| [wersja nieprzejrzana] | [wersja przejrzana] |
Utworzono nową stronę "local p = {} function p.grid( data ) local str = data.args[1] local num = data.args[2] str = string.gsub(str,',',';') local result = "" local strPos = 1 local nu..." |
d poprawka |
||
| (Nie pokazano 13 pośrednich wersji utworzonych przez tego samego użytkownika) | |||
| 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(str,';') and num == "" then | |||
return str | |||
end | |||
str = string.gsub(str,',',';') | str = string.gsub(str,',',';') | ||
| Linia 8: | Linia 11: | ||
local strPos = 1 | local strPos = 1 | ||
local numPos = 1 | local numPos = 1 | ||
if num | if num ~= "" then | ||
while string.find(num,',') | while string.find(num,',',numPos) do | ||
result = result..string.sub(str,strPos,string.find(str,';'))..',' | result = result..string.sub(str,strPos,string.find(str,';',strPos) - 1)..',' | ||
strPos = string.find(str,';') + 1 | strPos = string.find(str,';',strPos) + 1 | ||
result = result..string.sub(num,numPos,string.find(num,','))..';' | result = result..string.sub(num,numPos,string.find(num,',',numPos) - 1)..';' | ||
numPos = string.find(num,',') + 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 | ||
end | end | ||
result = result..string.sub(str,strPos,-1) | result = result..string.sub(str,strPos,-1) | ||
if ended == false then | |||
result = result..','..string.sub(num,numPos,-1) | |||
end | |||
return result | return result | ||
end | end | ||
return p | return p | ||
Aktualna wersja na dzień 08:11, 9 kwi 2021
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(str,';') 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