Minor fix

This commit is contained in:
Jean-Patrick Guerrero 2019-09-12 12:34:03 +02:00
parent 7c891ff2b6
commit 9dcccadfc2

View File

@ -199,32 +199,25 @@ function craftguide.register_craft(def)
c = c + 1 c = c + 1
end end
else else
local len = #def.items local items, len = def.items, #def.items
def.items = {}
for i = 1, len do for i = 1, len do
local cc = 1 items[i] = items[i]:gsub(",", ", ")
for char in gmatch(def.items[i], ".") do local rlen = #split(items[i], ",")
if char == "," and sub(def.items[i], cc, cc) == "," then
def.items[i] = sub(def.items[i], 1, cc) .. " " ..
sub(def.items[i], cc + 1)
end
cc = cc + 1
end
local rlen = #split(def.items[i], ",")
if rlen > def.width then if rlen > def.width then
def.width = rlen def.width = rlen
end end
end end
for i = 1, len do for i = 1, len do
while #split(def.items[i], ",") < def.width do while #split(items[i], ",") < def.width do
def.items[i] = def.items[i] .. ", " items[i] = items[i] .. ", "
end end
end end
for name in gmatch(concat(def.items, ","), "[%s%w_:]+") do for name in gmatch(concat(items, ","), "[%s%w_:]+") do
def.items[c] = clean_name(name) def.items[c] = clean_name(name)
c = c + 1 c = c + 1
end end