From 6f2652488502f9924de42b71b431ee8178c4cae2 Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Fri, 29 Jan 2021 01:45:14 +0100 Subject: [PATCH] Minor cleaning --- init.lua | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/init.lua b/init.lua index 147b884..48070fd 100644 --- a/init.lua +++ b/init.lua @@ -2541,22 +2541,17 @@ if rawget(_G, "worldedit") then local wfs = split(worldedit.pages.worldedit_gui.get_formspec(name), "]") local new_fs = {} - for i, elem in ipairs(wfs) do - if sub(elem, 1, 4) == "size" or sub(elem, 1, 5) == "label" or - find(elem, "worldedit_gui_exit") then - remove(wfs, i) - end - - wfs[i] = wfs[i] .. "]" + for i = 3, 1, -1 do + remove(wfs, i) end 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 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]", ename, X, Y, field, str:gsub("/", " / ")))