Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit b07f0c0

Browse files
committed
Minor cleaning
1 parent 92c5b1a commit b07f0c0

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

init.lua

+15-4
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,17 @@ local FMT = {
108108
arrow = "image_button[%f,%f;0.8,0.8;%s;%s;;;false;%s]",
109109
}
110110

111+
local function mul_elem(elem, n)
112+
local fstr, elems = "", {}
113+
114+
for i = 1, n do
115+
fstr = fstr .. "%s"
116+
elems[i] = elem
117+
end
118+
119+
return fmt(fstr, unpack(elems))
120+
end
121+
111122
craftguide.group_stereotypes = {
112123
dye = "dye:white",
113124
wool = "wool:white",
@@ -940,12 +951,12 @@ local function get_panels(data, fs)
940951
prev_name, PNG.prev, PNG.prev_hover,
941952
next_name, PNG.next, PNG.next_hover)
942953

943-
fs[#fs + 1] = fmt(FMT.button .. FMT.button,
954+
fs[#fs + 1] = fmt(mul_elem(FMT.button, 2),
944955
x_arrow + (is_recipe and xof_r or xof_u),
945956
y_arrow, 0.8, 0.8, prev_name, "",
946957
x_arrow + 1.8, y_arrow, 0.8, 0.8, next_name, "")
947958
else
948-
fs[#fs + 1] = fmt(FMT.arrow .. FMT.arrow,
959+
fs[#fs + 1] = fmt(mul_elem(FMT.arrow, 2),
949960
x_arrow + (is_recipe and xof_r or xof_u),
950961
y_arrow, PNG.prev, prev_name, PNG.prev_hover,
951962
x_arrow + 1.8, y_arrow, PNG.next, next_name, PNG.next_hover)
@@ -1000,7 +1011,7 @@ local function make_formspec(name)
10001011
PNG.prev, PNG.prev_hover,
10011012
PNG.next, PNG.next_hover)
10021013

1003-
fs[#fs + 1] = fmt(FMT.button .. FMT.button .. FMT.button .. FMT.button,
1014+
fs[#fs + 1] = fmt(mul_elem(FMT.button, 4),
10041015
sfinv_only and 2.6 or 2.54, -0.12, 0.85, 1, "search", "",
10051016
sfinv_only and 3.3 or 3.25, -0.12, 0.85, 1, "clear", "",
10061017
sfinv_only and 5.45 or (ROWS * 6.83) / 11, -0.12, 0.85, 1, "prev_page", "",
@@ -1013,7 +1024,7 @@ local function make_formspec(name)
10131024
sfinv_only and 2.6 or 2.54, PNG.search, PNG.search_hover,
10141025
sfinv_only and 3.3 or 3.25, PNG.clear, PNG.clear_hover)
10151026

1016-
fs[#fs + 1] = fmt(FMT.arrow .. FMT.arrow,
1027+
fs[#fs + 1] = fmt(mul_elem(FMT.arrow, 2),
10171028
sfinv_only and 5.45 or (ROWS * 6.83) / 11,
10181029
-0.05, PNG.prev, "prev_page", PNG.prev,
10191030
sfinv_only and 7.2 or (ROWS * 8.75) / 11,

0 commit comments

Comments
 (0)