Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
l_util.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include "lua_api/l_base.h"
8
9class AsyncEngine;
10
11class ModApiUtil : public ModApiBase
12{
13private:
14 /*
15 NOTE:
16 The functions in this module are available in the in-game API
17 as well as in the mainmenu API.
18
19 All functions that don't require either a Server or
20 GUIEngine instance should be in here.
21 */
22
23 // log([level,] text)
24 // Writes a line to the logger.
25 // The one-argument version logs to LL_NONE.
26 // The two-argument version accepts a log level.
27 static int l_log(lua_State *L);
28
29 // get us precision time
30 static int l_get_us_time(lua_State *L);
31
32 // parse_json(str[, nullvalue])
33 static int l_parse_json(lua_State *L);
34
35 // write_json(data[, styled])
36 static int l_write_json(lua_State *L);
37
38 // get_tool_wear_after_use(uses[, initial_wear])
39 static int l_get_tool_wear_after_use(lua_State *L);
40
41 // get_dig_params(groups, tool_capabilities[, wear])
42 static int l_get_dig_params(lua_State *L);
43
44 // get_hit_params(groups, tool_capabilities[, time_from_last_punch[, wear]])
45 static int l_get_hit_params(lua_State *L);
46
47 // check_password_entry(name, entry, password)
48 static int l_check_password_entry(lua_State *L);
49
50 // get_password_hash(name, raw_password)
51 static int l_get_password_hash(lua_State *L);
52
53 // is_yes(arg)
54 static int l_is_yes(lua_State *L);
55
56 // get_builtin_path()
57 static int l_get_builtin_path(lua_State *L);
58
59 // get_user_path()
60 static int l_get_user_path(lua_State *L);
61
62 // compress(data, method, ...)
63 static int l_compress(lua_State *L);
64
65 // decompress(data, method, ...)
66 static int l_decompress(lua_State *L);
67
68 // mkdir(path)
69 static int l_mkdir(lua_State *L);
70
71 // rmdir(path, recursive)
72 static int l_rmdir(lua_State *L);
73
74 // cpdir(source, destination, remove_source)
75 static int l_cpdir(lua_State *L);
76
77 // mvdir(source, destination)
78 static int l_mvdir(lua_State *L);
79
80 // get_dir_list(path, is_dir)
81 static int l_get_dir_list(lua_State *L);
82
83 // safe_file_write(path, content)
84 static int l_safe_file_write(lua_State *L);
85
86 // request_insecure_environment()
87 static int l_request_insecure_environment(lua_State *L);
88
89 // encode_base64(string)
90 static int l_encode_base64(lua_State *L);
91
92 // decode_base64(string)
93 static int l_decode_base64(lua_State *L);
94
95 // get_version()
96 static int l_get_version(lua_State *L);
97
98 // sha1(string, raw)
99 static int l_sha1(lua_State *L);
100
101 // sha256(string, raw)
102 static int l_sha256(lua_State *L);
103
104 // colorspec_to_colorstring(colorspec)
105 static int l_colorspec_to_colorstring(lua_State *L);
106
107 // colorspec_to_bytes(colorspec)
108 static int l_colorspec_to_bytes(lua_State *L);
109
110 // colorspec_to_table(colorspec)
111 static int l_colorspec_to_table(lua_State *L);
112
113 // time_to_day_night_ratio(time_of_day)
114 static int l_time_to_day_night_ratio(lua_State *L);
115
116 // encode_png(w, h, data, level)
117 static int l_encode_png(lua_State *L);
118
119 // get_last_run_mod()
120 static int l_get_last_run_mod(lua_State *L);
121
122 // set_last_run_mod(modname)
123 static int l_set_last_run_mod(lua_State *L);
124
125 // urlencode(value)
126 static int l_urlencode(lua_State *L);
127
128 // is_valid_player_name(name)
129 static int l_is_valid_player_name(lua_State *L);
130
131public:
132 static void Initialize(lua_State *L, int top);
133 static void InitializeAsync(lua_State *L, int top);
134 static void InitializeClient(lua_State *L, int top);
135};
Definition s_async.h:67
Definition l_base.h:28
Definition l_util.h:12
static int l_get_tool_wear_after_use(lua_State *L)
Definition l_util.cpp:166
static int l_parse_json(lua_State *L)
Definition l_util.cpp:86
static int l_colorspec_to_table(lua_State *L)
Definition l_util.cpp:619
static int l_write_json(lua_State *L)
Definition l_util.cpp:136
static int l_urlencode(lua_State *L)
Definition l_util.cpp:683
static int l_rmdir(lua_State *L)
Definition l_util.cpp:410
static int l_request_insecure_environment(lua_State *L)
Definition l_util.cpp:493
static int l_sha256(lua_State *L)
Definition l_util.cpp:560
static int l_get_version(lua_State *L)
Definition l_util.cpp:508
static int l_get_last_run_mod(lua_State *L)
Definition l_util.cpp:661
static int l_get_builtin_path(lua_State *L)
Definition l_util.cpp:263
static int l_get_us_time(lua_State *L)
Definition l_util.cpp:74
static int l_sha1(lua_State *L)
Definition l_util.cpp:535
static int l_time_to_day_night_ratio(lua_State *L)
Definition l_util.cpp:633
static int l_get_user_path(lua_State *L)
Definition l_util.cpp:274
static int l_safe_file_write(lua_State *L)
Definition l_util.cpp:478
static int l_decompress(lua_State *L)
Definition l_util.cpp:344
static void Initialize(lua_State *L, int top)
Definition l_util.cpp:702
static int l_mkdir(lua_State *L)
Definition l_util.cpp:400
static int l_get_password_hash(lua_State *L)
Definition l_util.cpp:236
static int l_get_dir_list(lua_State *L)
Definition l_util.cpp:453
static int l_check_password_entry(lua_State *L)
Definition l_util.cpp:207
static int l_is_valid_player_name(lua_State *L)
Definition l_util.cpp:693
static int l_colorspec_to_bytes(lua_State *L)
Definition l_util.cpp:599
static void InitializeClient(lua_State *L, int top)
Definition l_util.cpp:758
static int l_decode_base64(lua_State *L)
Definition l_util.cpp:382
static int l_get_hit_params(lua_State *L)
Definition l_util.cpp:193
static int l_encode_base64(lua_State *L)
Definition l_util.cpp:369
static void InitializeAsync(lua_State *L, int top)
Definition l_util.cpp:792
static int l_mvdir(lua_State *L)
Definition l_util.cpp:440
static int l_set_last_run_mod(lua_State *L)
Definition l_util.cpp:673
static int l_is_yes(lua_State *L)
Definition l_util.cpp:247
static int l_encode_png(lua_State *L)
Definition l_util.cpp:644
static int l_colorspec_to_colorstring(lua_State *L)
Definition l_util.cpp:582
static int l_compress(lua_State *L)
Definition l_util.cpp:313
static int l_get_dig_params(lua_State *L)
Definition l_util.cpp:177
static int l_cpdir(lua_State *L)
Definition l_util.cpp:427
static int l_log(lua_State *L)
Definition l_util.cpp:48