-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathformspec.lua
60 lines (54 loc) · 1.94 KB
/
formspec.lua
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
---@meta
---Formspec
-----------
-- Show a formspec to a player.
---@param playername string Name of player to show formspec.
---@param formname string Passed to `on_player_receive_fields` callbacks, should follow the `"modname:<whatever>"` naming convention.
---@param formspec string Formspec to display.
function minetest.show_formspec(playername, formname, formspec) end
-- Close a formspec.
--
-- Calling `show_formspec(playername, formname, "")` is equal to this expression.
--
-- To close a formspec regardless of the formname, call `minetest.close_formspec(playername, "")`.
--
-- **USE THIS ONLY WHEN ABSOLUTELY NECESSARY!**
---@param playername string Name of player to close formspec
---@param formname string Has to exactly match the one given in `show_formspec`, or the formspec will not close
function minetest.close_formspec(playername, formname) end
-- Escapes the characters `"["`, `"]"`, `"\"`, `","` and `";"`,
-- which can not be used in formspecs.
---@param string string
---@return string
---@nodiscard
function minetest.formspec_escape(string) end
-- Returns e.g. `{type="CHG", row=1, column=2}`
--
-- `type` is one of:
-- * `"INV"`: no row selected
-- * `"CHG"`: selected
-- * `"DCL"`: double-click
---@param string string
---@return {type: '"INV"'|'"CHG"'|'"DCL"', row: integer, column: integer}
---@nodiscard
function minetest.explode_table_event(string) end
-- Returns e.g. `{type="CHG", index=1}`
--
-- `type` is one of:
-- * `"INV"`: no row selected
-- * `"CHG"`: selected
-- * `"DCL"`: double-click
---@param string string
---@return {type: '"INV"'|'"CHG"'|'"DCL"', index: integer}
---@nodiscard
function minetest.explode_textlist_event(string) end
-- Returns e.g. `{type="CHG", value=500}`
--
-- `type` is one of:
-- * `"INV"`: something failed
-- * `"CHG"`: has been changed
-- * `"VAL"`: not changed
---@param string string
---@return {type: '"INV"'|'"CHG"'|'"DCL"', value: integer}
---@nodiscard
function minetest.explode_scrollbar_event(string) end