]> git.lizzy.rs Git - dragonfireclient.git/blob - src/script/lua_api/l_mainmenu.h
Remove remaining modstore code (#6120)
[dragonfireclient.git] / src / script / lua_api / l_mainmenu.h
1 /*
2 Minetest
3 Copyright (C) 2013 sapier
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_MAINMENU_H_
21 #define L_MAINMENU_H_
22
23 #include "lua_api/l_base.h"
24
25 class AsyncEngine;
26
27 /** Implementation of lua api support for mainmenu */
28 class ModApiMainMenu: public ModApiBase
29 {
30
31 private:
32         /**
33          * read a text variable from gamedata table within lua stack
34          * @param L stack to read variable from
35          * @param name name of variable to read
36          * @return string value of requested variable
37          */
38         static std::string getTextData(lua_State *L, std::string name);
39
40         /**
41          * read a integer variable from gamedata table within lua stack
42          * @param L stack to read variable from
43          * @param name name of variable to read
44          * @return integer value of requested variable
45          */
46         static int getIntegerData(lua_State *L, std::string name,bool& valid);
47
48         /**
49          * read a bool variable from gamedata table within lua stack
50          * @param L stack to read variable from
51          * @param name name of variable to read
52          * @return bool value of requested variable
53          */
54         static int getBoolData(lua_State *L, std::string name,bool& valid);
55
56         /**
57          * check if a path is within some of minetests folders
58          * @param path path to check
59          * @return true/false
60          */
61         static bool isMinetestPath(std::string path);
62
63         //api calls
64
65         static int l_start(lua_State *L);
66
67         static int l_close(lua_State *L);
68
69         static int l_create_world(lua_State *L);
70
71         static int l_delete_world(lua_State *L);
72
73         static int l_get_worlds(lua_State *L);
74
75         static int l_get_games(lua_State *L);
76
77         static int l_get_mapgen_names(lua_State *L);
78
79         static int l_get_favorites(lua_State *L);
80
81         static int l_delete_favorite(lua_State *L);
82
83         static int l_gettext(lua_State *L);
84
85         //gui
86
87         static int l_show_keys_menu(lua_State *L);
88
89         static int l_show_path_select_dialog(lua_State *L);
90
91         static int l_set_topleft_text(lua_State *L);
92
93         static int l_set_clouds(lua_State *L);
94
95         static int l_get_textlist_index(lua_State *L);
96
97         static int l_get_table_index(lua_State *L);
98
99         static int l_set_background(lua_State *L);
100
101         static int l_update_formspec(lua_State *L);
102
103         static int l_get_screen_info(lua_State *L);
104
105         //filesystem
106
107         static int l_get_mainmenu_path(lua_State *L);
108
109         static int l_get_modpath(lua_State *L);
110
111         static int l_get_clientmodpath(lua_State *L);
112
113         static int l_get_gamepath(lua_State *L);
114
115         static int l_get_texturepath(lua_State *L);
116
117         static int l_get_texturepath_share(lua_State *L);
118
119         static int l_create_dir(lua_State *L);
120
121         static int l_delete_dir(lua_State *L);
122
123         static int l_copy_dir(lua_State *L);
124
125         static int l_extract_zip(lua_State *L);
126
127         static int l_download_file(lua_State *L);
128
129         static int l_get_video_drivers(lua_State *L);
130
131         static int l_get_video_modes(lua_State *L);
132
133         //version compatibility
134         static int l_get_min_supp_proto(lua_State *L);
135
136         static int l_get_max_supp_proto(lua_State *L);
137
138
139         // async
140         static int l_do_async_callback(lua_State *L);
141
142 public:
143
144         /**
145          * initialize this API module
146          * @param L lua stack to initialize
147          * @param top index (in lua stack) of global API table
148          */
149         static void Initialize(lua_State *L, int top);
150
151         static void InitializeAsync(lua_State *L, int top);
152
153 };
154
155 #endif /* L_MAINMENU_H_ */