Moduł:Inventory slot/Furnace: Różnice pomiędzy wersjami
Przejdź do nawigacji
Przejdź do wyszukiwania
| [wersja nieprzejrzana] | [wersja nieprzejrzana] |
d styl |
d poprawka |
||
| Linia 16: | Linia 16: | ||
end | end | ||
end | end | ||
local ended = false | |||
if string.find(str,';',strPos) then | if string.find(str,';',strPos) then | ||
if num ~= "" then | if num ~= "" then | ||
result = result..string.sub(str,strPos,string.find(str,';',strPos) - 1)..','..string.sub(num,numPos,-1)..';' | result = result..string.sub(str,strPos,string.find(str,';',strPos) - 1)..','..string.sub(num,numPos,-1)..';' | ||
strPos = string.find(str,';',strPos) + 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 | if ended == false then | ||
result = result..','..string.sub(num,numPos,-1) | result = result..','..string.sub(num,numPos,-1) | ||
end | end | ||
Wersja z 15:23, 26 mar 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]
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