3 Copyright (C) 2013 sapier
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.
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.
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.
23 #include "lua_api/l_base.h"
25 /** Implementation of lua api support for mainmenu */
26 class ModApiMainMenu : public ModApiBase {
30 * read a text variable from gamedata table within lua stack
31 * @param L stack to read variable from
32 * @param name name of variable to read
33 * @return string value of requested variable
35 static std::string getTextData(lua_State *L, std::string name);
38 * read a integer variable from gamedata table within lua stack
39 * @param L stack to read variable from
40 * @param name name of variable to read
41 * @return integer value of requested variable
43 static int getIntegerData(lua_State *L, std::string name,bool& valid);
46 * read a bool variable from gamedata table within lua stack
47 * @param L stack to read variable from
48 * @param name name of variable to read
49 * @return bool value of requested variable
51 static int getBoolData(lua_State *L, std::string name,bool& valid);
54 * check if a path is within some of minetests folders
55 * @param path path to check
58 static bool isMinetestPath(std::string path);
62 static int l_start(lua_State *L);
64 static int l_close(lua_State *L);
66 static int l_create_world(lua_State *L);
68 static int l_delete_world(lua_State *L);
70 static int l_get_worlds(lua_State *L);
72 static int l_get_games(lua_State *L);
74 static int l_get_favorites(lua_State *L);
76 static int l_delete_favorite(lua_State *L);
78 static int l_get_version(lua_State *L);
80 static int l_sound_play(lua_State *L);
82 static int l_sound_stop(lua_State *L);
86 static int l_show_keys_menu(lua_State *L);
88 static int l_show_file_open_dialog(lua_State *L);
90 static int l_set_topleft_text(lua_State *L);
92 static int l_set_clouds(lua_State *L);
94 static int l_get_textlist_index(lua_State *L);
96 static int l_set_background(lua_State *L);
98 static int l_update_formspec(lua_State *L);
102 static int l_get_scriptdir(lua_State *L);
104 static int l_get_modpath(lua_State *L);
106 static int l_get_gamepath(lua_State *L);
108 static int l_get_texturepath(lua_State *L);
110 static int l_get_dirlist(lua_State *L);
112 static int l_create_dir(lua_State *L);
114 static int l_delete_dir(lua_State *L);
116 static int l_copy_dir(lua_State *L);
118 static int l_extract_zip(lua_State *L);
120 static int l_get_modstore_details(lua_State *L);
122 static int l_get_modstore_list(lua_State *L);
124 static int l_download_file(lua_State *L);
129 * initialize this API module
130 * @param L lua stack to initialize
131 * @param top index (in lua stack) of global API table
133 static void Initialize(lua_State *L, int top);
137 #endif /* L_MAINMENU_H_ */