/advtrains_line_automation/textures/

'>tracy Advtrains mod for minetest.orwell
aboutsummaryrefslogtreecommitdiff
path: root/advtrains/formspec.lua
blob: 86d8b27986962d41ec9ae483c0a6e6293e3acfbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
local sformat = string.format
local fsescape = minetest.formspec_escape

-- Get current translator
local S = advtrains.translate

local function make_list(entries)
	local t = {}
	for k, v in ipairs(entries) do
		t[k] = fsescape(v)
	end
	return table.concat(t, ",")
end

local function S_wrapper(f, i0)
	return function(...)
		local args = {...}
		args[i0] = S(unpack(args,i0))
		return f(unpack(args,1,i0))
	end
end

local function f_button(x, y, w, id, text)
	return sformat("button[%f,%f;%f,0.75;%s;%s]", x, y, w, id, text)
end

local function f_checkbox(x, y, name, selected, label)
	return sformat("checkbox[%f,%f;%s;%s;%s]", x, y+0.25, name, label, selected and "true" or "false")
end

local function f_button_exit(x, y, w, id, text)
	return sformat("button_exit[%f,%f;%f,0.75;%s;%s]", x, y, w, id, text)
end

local function f_dropdown(x, y, w, id, entries, sel, indexed)
	return sformat("dropdown[%f,%f;%f,0.75;%s;%s;%d%s]",
		x, y, w, id, make_list(entries),