Minor cleaning

This commit is contained in:
Jean-Patrick Guerrero 2021-01-29 01:45:14 +01:00
parent e091ca1c43
commit 6f26524885

View File

@ -2541,22 +2541,17 @@ if rawget(_G, "worldedit") then
local wfs = split(worldedit.pages.worldedit_gui.get_formspec(name), "]") local wfs = split(worldedit.pages.worldedit_gui.get_formspec(name), "]")
local new_fs = {} local new_fs = {}
for i, elem in ipairs(wfs) do for i = 3, 1, -1 do
if sub(elem, 1, 4) == "size" or sub(elem, 1, 5) == "label" or remove(wfs, i)
find(elem, "worldedit_gui_exit") then
remove(wfs, i)
end
wfs[i] = wfs[i] .. "]"
end end
for i, elem in ipairs(wfs) do for i, elem in ipairs(wfs) do
local ename, field, str = match(elem, "(.*)%[.*%d+;(.*);(.*)]") local ename, field, str = match(elem, "(.*)%[.*%d+;(.*);(.*)$")
local X = i % 3 local X = i % 3
X = X + (X * 2.42) + 0.2 X = X + (X * 2.42) + 0.2
local Y = floor((i % (#wfs - 1) - X) / 3 + 1) + 1.2 local Y = floor((i % #wfs - X) / 3 - 1) + 2.2
insert(new_fs, fmt("%s[%f,%f;3,0.8;%s;%s]", insert(new_fs, fmt("%s[%f,%f;3,0.8;%s;%s]",
ename, X, Y, field, str:gsub("/", " / "))) ename, X, Y, field, str:gsub("/", " / ")))