Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
l_util.h
Go to the documentation of this file.
1/*
2Minetest
3Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5This program is free software; you can redistribute it and/or modify
6it under the terms of the GNU Lesser General Public License as published by
7the Free Software Foundation; either version 2.1 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU Lesser General Public License for more details.
14
15You should have received a copy of the GNU Lesser General Public License along
16with this program; if not, write to the Free Software Foundation, Inc.,
1751 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18*/
19
20#pragma once
21
22#include "lua_api/l_base.h"
23
24class AsyncEngine;
25
26class ModApiUtil : public ModApiBase
27{
28private:
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_tool_wear_after_use(uses[, initial_wear])
54 static int l_get_tool_wear_after_use(lua_State *L);
55
56 // get_dig_params(groups, tool_capabilities[, wear])
57 static int l_get_dig_params(lua_State *L);
58
59 // get_hit_params(groups, tool_capabilities[, time_from_last_punch[, wear]])
60 static int l_get_hit_params(lua_State *L);
61
62 // check_password_entry(name, entry, password)
63 static int l_check_password_entry(lua_State *L);
64
65 // get_password_hash(name, raw_password)
66 static int l_get_password_hash(lua_State *L);
67
68 // is_yes(arg)
69 static int l_is_yes(lua_State *L);
70
71 // get_builtin_path()
72 static int l_get_builtin_path(lua_State *L);
73
74 // get_user_path()
75 static int l_get_user_path(lua_State *L);
76
77 // compress(data, method, ...)
78 static int l_compress(lua_State *L);
79
80 // decompress(data, method, ...)
81 static int l_decompress(lua_State *L);
82
83 // mkdir(path)
84 static int l_mkdir(lua_State *L);
85
86 // rmdir(path, recursive)
87 static int l_rmdir(lua_State *L);
88
89 // cpdir(source, destination, remove_source)
90 static int l_cpdir(lua_State *L);
91
92 // mvdir(source, destination)
93 static int l_mvdir(lua_State *L);
94
95 // get_dir_list(path, is_dir)
96 static int l_get_dir_list(lua_State *L);
97
98 // safe_file_write(path, content)
99 static int l_safe_file_write(lua_State *L);
100
101 // request_insecure_environment()
102 static int l_request_insecure_environment(lua_State *L);
103
104 // encode_base64(string)
105 static int l_encode_base64(lua_State *L);
106
107 // decode_base64(string)
108 static int l_decode_base64(lua_State *L);
109
110 // get_version()
111 static int l_get_version(lua_State *L);
112
113 // sha1(string, raw)
114 static int l_sha1(lua_State *L);
115
116 // sha256(string, raw)
117 static int l_sha256(lua_State *L);
118
119 // colorspec_to_colorstring(colorspec)
120 static int l_colorspec_to_colorstring(lua_State *L);
121
122 // colorspec_to_bytes(colorspec)
123 static int l_colorspec_to_bytes(lua_State *L);
124
125 // encode_png(w, h, data, level)
126 static int l_encode_png(lua_State *L);
127
128 // get_last_run_mod()
129 static int l_get_last_run_mod(lua_State *L);
130
131 // set_last_run_mod(modname)
132 static int l_set_last_run_mod(lua_State *L);
133
134 // urlencode(value)
135 static int l_urlencode(lua_State *L);
136
137public:
138 static void Initialize(lua_State *L, int top);
139 static void InitializeAsync(lua_State *L, int top);
140 static void InitializeClient(lua_State *L, int top);
141};
Definition: s_async.h:79
Definition: l_base.h:43
Definition: l_util.h:27
static int l_get_tool_wear_after_use(lua_State *L)
Definition: l_util.cpp:171
static int l_parse_json(lua_State *L)
Definition: l_util.cpp:94
static int l_write_json(lua_State *L)
Definition: l_util.cpp:141
static int l_urlencode(lua_State *L)
Definition: l_util.cpp:668
static int l_rmdir(lua_State *L)
Definition: l_util.cpp:415
static int l_request_insecure_environment(lua_State *L)
Definition: l_util.cpp:498
static int l_sha256(lua_State *L)
Definition: l_util.cpp:570
static int l_get_version(lua_State *L)
Definition: l_util.cpp:518
static int l_get_last_run_mod(lua_State *L)
Definition: l_util.cpp:646
static int l_get_builtin_path(lua_State *L)
Definition: l_util.cpp:268
static int l_get_us_time(lua_State *L)
Definition: l_util.cpp:86
static int l_sha1(lua_State *L)
Definition: l_util.cpp:545
static int l_get_user_path(lua_State *L)
Definition: l_util.cpp:279
static int l_safe_file_write(lua_State *L)
Definition: l_util.cpp:483
static int l_decompress(lua_State *L)
Definition: l_util.cpp:349
static void Initialize(lua_State *L, int top)
Definition: l_util.cpp:677
static int l_mkdir(lua_State *L)
Definition: l_util.cpp:405
static int l_get_password_hash(lua_State *L)
Definition: l_util.cpp:241
static int l_get_dir_list(lua_State *L)
Definition: l_util.cpp:458
static int l_check_password_entry(lua_State *L)
Definition: l_util.cpp:212
static int l_colorspec_to_bytes(lua_State *L)
Definition: l_util.cpp:609
static void InitializeClient(lua_State *L, int top)
Definition: l_util.cpp:730
static int l_decode_base64(lua_State *L)
Definition: l_util.cpp:387
static int l_get_hit_params(lua_State *L)
Definition: l_util.cpp:198
static int l_encode_base64(lua_State *L)
Definition: l_util.cpp:374
static void InitializeAsync(lua_State *L, int top)
Definition: l_util.cpp:762
static int l_mvdir(lua_State *L)
Definition: l_util.cpp:445
static int l_set_last_run_mod(lua_State *L)
Definition: l_util.cpp:658
static int l_is_yes(lua_State *L)
Definition: l_util.cpp:252
static int l_encode_png(lua_State *L)
Definition: l_util.cpp:629
static int l_colorspec_to_colorstring(lua_State *L)
Definition: l_util.cpp:592
static int l_compress(lua_State *L)
Definition: l_util.cpp:318
static int l_get_dig_params(lua_State *L)
Definition: l_util.cpp:182
static int l_cpdir(lua_State *L)
Definition: l_util.cpp:432
static int l_log(lua_State *L)
Definition: l_util.cpp:60