forked from minetest-mods/craftguide
Minor fix
This commit is contained in:
parent
7c891ff2b6
commit
9dcccadfc2
21
init.lua
21
init.lua
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user