]> git.lizzy.rs Git - minetest.git/blob - src/script/lua_api/l_util.h
cfdeea1e8618b73c66523a80e43b98814fe05be9
[minetest.git] / src / script / lua_api / l_util.h
1 /*
2 Minetest
3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef L_UTIL_H_
21 #define L_UTIL_H_
22
23 #include "lua_api/l_base.h"
24
25 class AsyncEngine;
26
27 class ModApiUtil : public ModApiBase {
28 private:
29         /*
30                 NOTE:
31                 The functions in this module are available in the in-game API
32                 as well as in the mainmenu API.
33
34                 All functions that don't require either a Server or
35                 GUIEngine instance should be in here.
36         */
37
38         // debug(text)
39         // Writes a line to dstream
40         static int l_debug(lua_State *L);
41
42         // log([level,] text)
43         // Writes a line to the logger.
44         // The one-argument version logs to infostream.
45         // The two-argument version accept a log level: error, action, info, or verbose.
46         static int l_log(lua_State *L);
47
48         // setting_set(name, value)
49         static int l_setting_set(lua_State *L);
50
51         // setting_get(name)
52         static int l_setting_get(lua_State *L);
53
54         // setting_setbool(name, value)
55         static int l_setting_setbool(lua_State *L);
56
57         // setting_getbool(name)
58         static int l_setting_getbool(lua_State *L);
59
60         // setting_save()
61         static int l_setting_save(lua_State *L);
62
63         // parse_json(str[, nullvalue])
64         static int l_parse_json(lua_State *L);
65
66         // write_json(data[, styled])
67         static int l_write_json(lua_State *L);
68
69         // get_dig_params(groups, tool_capabilities[, time_from_last_punch])
70         static int l_get_dig_params(lua_State *L);
71
72         // get_hit_params(groups, tool_capabilities[, time_from_last_punch])
73         static int l_get_hit_params(lua_State *L);
74
75         // get_password_hash(name, raw_password)
76         static int l_get_password_hash(lua_State *L);
77
78         // is_yes(arg)
79         static int l_is_yes(lua_State *L);
80
81         // get_scriptdir()
82         static int l_get_builtin_path(lua_State *L);
83
84 public:
85         static void Initialize(lua_State *L, int top);
86
87         static void InitializeAsync(AsyncEngine& engine);
88
89 };
90
91 #endif /* L_UTIL_H_ */