]> git.lizzy.rs Git - dragonfireclient.git/blob - src/script/lua_api/l_util.h
cc55635776bddb00f03b0e0e43ba3c20ebb24a93
[dragonfireclient.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 #pragma once
21
22 #include "lua_api/l_base.h"
23
24 class AsyncEngine;
25
26 class ModApiUtil : public ModApiBase
27 {
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         // log([level,] text)
39         // Writes a line to the logger.
40         // The one-argument version logs to LL_NONE.
41         // The two-argument version accepts a log level.
42         static int l_log(lua_State *L);
43
44         // get us precision time
45         static int l_get_us_time(lua_State *L);
46
47         // parse_json(str[, nullvalue])
48         static int l_parse_json(lua_State *L);
49
50         // write_json(data[, styled])
51         static int l_write_json(lua_State *L);
52
53         // get_dig_params(groups, tool_capabilities[, wear])
54         static int l_get_dig_params(lua_State *L);
55
56         // get_hit_params(groups, tool_capabilities[, time_from_last_punch[, wear]])
57         static int l_get_hit_params(lua_State *L);
58
59         // check_password_entry(name, entry, password)
60         static int l_check_password_entry(lua_State *L);
61
62         // get_password_hash(name, raw_password)
63         static int l_get_password_hash(lua_State *L);
64
65         // is_yes(arg)
66         static int l_is_yes(lua_State *L);
67
68         // get_builtin_path()
69         static int l_get_builtin_path(lua_State *L);
70
71         // get_user_path()
72         static int l_get_user_path(lua_State *L);
73
74         // compress(data, method, ...)
75         static int l_compress(lua_State *L);
76
77         // decompress(data, method, ...)
78         static int l_decompress(lua_State *L);
79
80         // mkdir(path)
81         static int l_mkdir(lua_State *L);
82
83         // rmdir(path, recursive)
84         static int l_rmdir(lua_State *L);
85
86         // cpdir(source, destination, remove_source)
87         static int l_cpdir(lua_State *L);
88
89         // mvdir(source, destination)
90         static int l_mvdir(lua_State *L);
91
92         // get_dir_list(path, is_dir)
93         static int l_get_dir_list(lua_State *L);
94
95         // safe_file_write(path, content)
96         static int l_safe_file_write(lua_State *L);
97
98         // request_insecure_environment()
99         static int l_request_insecure_environment(lua_State *L);
100
101         // encode_base64(string)
102         static int l_encode_base64(lua_State *L);
103
104         // decode_base64(string)
105         static int l_decode_base64(lua_State *L);
106
107         // get_version()
108         static int l_get_version(lua_State *L);
109
110         // sha1(string, raw)
111         static int l_sha1(lua_State *L);
112
113         // colorspec_to_colorstring(colorspec)
114         static int l_colorspec_to_colorstring(lua_State *L);
115
116         // colorspec_to_bytes(colorspec)
117         static int l_colorspec_to_bytes(lua_State *L);
118
119         // encode_png(w, h, data, level)
120         static int l_encode_png(lua_State *L);
121
122         // get_last_run_mod()
123         static int l_get_last_run_mod(lua_State *L);
124
125         // set_last_run_mod(modname)
126         static int l_set_last_run_mod(lua_State *L);
127
128 public:
129         static void Initialize(lua_State *L, int top);
130         static void InitializeAsync(lua_State *L, int top);
131         static void InitializeClient(lua_State *L, int top);
132 };