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.
20 #include "lua_api/l_mainmenu.h"
21 #include "lua_api/l_internal.h"
22 #include "common/c_content.h"
23 #include "cpp_api/s_async.h"
24 #include "scripting_mainmenu.h"
25 #include "gui/guiEngine.h"
26 #include "gui/guiMainMenu.h"
27 #include "gui/guiKeyChangeMenu.h"
28 #include "gui/guiPathSelectMenu.h"
32 #include "convert_json.h"
33 #include "content/content.h"
34 #include "content/subgames.h"
35 #include "serverlist.h"
36 #include "mapgen/mapgen.h"
38 #include "client/client.h"
39 #include "client/renderingengine.h"
40 #include "network/networkprotocol.h"
43 /******************************************************************************/
44 std::string ModApiMainMenu::getTextData(lua_State *L, std::string name)
46 lua_getglobal(L, "gamedata");
48 lua_getfield(L, -1, name.c_str());
53 return luaL_checkstring(L, -1);
56 /******************************************************************************/
57 int ModApiMainMenu::getIntegerData(lua_State *L, std::string name,bool& valid)
59 lua_getglobal(L, "gamedata");
61 lua_getfield(L, -1, name.c_str());
63 if(lua_isnil(L, -1)) {
69 return luaL_checkinteger(L, -1);
72 /******************************************************************************/
73 int ModApiMainMenu::getBoolData(lua_State *L, std::string name,bool& valid)
75 lua_getglobal(L, "gamedata");
77 lua_getfield(L, -1, name.c_str());
79 if(lua_isnil(L, -1)) {
85 return readParam<bool>(L, -1);
88 /******************************************************************************/
89 int ModApiMainMenu::l_update_formspec(lua_State *L)
91 GUIEngine* engine = getGuiEngine(L);
92 sanity_check(engine != NULL);
94 if (engine->m_startgame)
98 std::string formspec(luaL_checkstring(L, 1));
100 if (engine->m_formspecgui != 0) {
101 engine->m_formspecgui->setForm(formspec);
107 /******************************************************************************/
108 int ModApiMainMenu::l_set_formspec_prepend(lua_State *L)
110 GUIEngine *engine = getGuiEngine(L);
111 sanity_check(engine != NULL);
113 if (engine->m_startgame)
116 std::string formspec(luaL_checkstring(L, 1));
117 engine->setFormspecPrepend(formspec);
122 /******************************************************************************/
123 int ModApiMainMenu::l_start(lua_State *L)
125 GUIEngine* engine = getGuiEngine(L);
126 sanity_check(engine != NULL);
128 //update c++ gamedata from lua table
132 MainMenuData *data = engine->m_data;
134 data->selected_world = getIntegerData(L, "selected_world",valid) -1;
135 data->simple_singleplayer_mode = getBoolData(L,"singleplayer",valid);
136 data->do_reconnect = getBoolData(L, "do_reconnect", valid);
137 if (!data->do_reconnect) {
138 data->name = getTextData(L,"playername");
139 data->password = getTextData(L,"password");
140 data->address = getTextData(L,"address");
141 data->port = getTextData(L,"port");
143 data->serverdescription = getTextData(L,"serverdescription");
144 data->servername = getTextData(L,"servername");
146 //close menu next time
147 engine->m_startgame = true;
151 /******************************************************************************/
152 int ModApiMainMenu::l_close(lua_State *L)
154 GUIEngine* engine = getGuiEngine(L);
155 sanity_check(engine != NULL);
157 engine->m_kill = true;
161 /******************************************************************************/
162 int ModApiMainMenu::l_set_background(lua_State *L)
164 GUIEngine* engine = getGuiEngine(L);
165 sanity_check(engine != NULL);
167 std::string backgroundlevel(luaL_checkstring(L, 1));
168 std::string texturename(luaL_checkstring(L, 2));
170 bool tile_image = false;
172 unsigned int minsize = 16;
174 if (!lua_isnone(L, 3)) {
175 tile_image = readParam<bool>(L, 3);
178 if (!lua_isnone(L, 4)) {
179 minsize = lua_tonumber(L, 4);
182 if (backgroundlevel == "background") {
183 retval |= engine->setTexture(TEX_LAYER_BACKGROUND, texturename,
184 tile_image, minsize);
187 if (backgroundlevel == "overlay") {
188 retval |= engine->setTexture(TEX_LAYER_OVERLAY, texturename,
189 tile_image, minsize);
192 if (backgroundlevel == "header") {
193 retval |= engine->setTexture(TEX_LAYER_HEADER, texturename,
194 tile_image, minsize);
197 if (backgroundlevel == "footer") {
198 retval |= engine->setTexture(TEX_LAYER_FOOTER, texturename,
199 tile_image, minsize);
202 lua_pushboolean(L,retval);
206 /******************************************************************************/
207 int ModApiMainMenu::l_set_clouds(lua_State *L)
209 GUIEngine* engine = getGuiEngine(L);
210 sanity_check(engine != NULL);
212 bool value = readParam<bool>(L,1);
214 engine->m_clouds_enabled = value;
219 /******************************************************************************/
220 int ModApiMainMenu::l_get_textlist_index(lua_State *L)
222 // get_table_index accepts both tables and textlists
223 return l_get_table_index(L);
226 /******************************************************************************/
227 int ModApiMainMenu::l_get_table_index(lua_State *L)
229 GUIEngine* engine = getGuiEngine(L);
230 sanity_check(engine != NULL);
232 std::string tablename(luaL_checkstring(L, 1));
233 GUITable *table = engine->m_menu->getTable(tablename);
234 s32 selection = table ? table->getSelected() : 0;
237 lua_pushinteger(L, selection);
243 /******************************************************************************/
244 int ModApiMainMenu::l_get_worlds(lua_State *L)
246 std::vector<WorldSpec> worlds = getAvailableWorlds();
249 int top = lua_gettop(L);
250 unsigned int index = 1;
252 for (const WorldSpec &world : worlds) {
253 lua_pushnumber(L,index);
256 int top_lvl2 = lua_gettop(L);
258 lua_pushstring(L,"path");
259 lua_pushstring(L, world.path.c_str());
260 lua_settable(L, top_lvl2);
262 lua_pushstring(L,"name");
263 lua_pushstring(L, world.name.c_str());
264 lua_settable(L, top_lvl2);
266 lua_pushstring(L,"gameid");
267 lua_pushstring(L, world.gameid.c_str());
268 lua_settable(L, top_lvl2);
270 lua_settable(L, top);
276 /******************************************************************************/
277 int ModApiMainMenu::l_get_games(lua_State *L)
279 std::vector<SubgameSpec> games = getAvailableGames();
282 int top = lua_gettop(L);
283 unsigned int index = 1;
285 for (const SubgameSpec &game : games) {
286 lua_pushnumber(L, index);
288 int top_lvl2 = lua_gettop(L);
290 lua_pushstring(L, "id");
291 lua_pushstring(L, game.id.c_str());
292 lua_settable(L, top_lvl2);
294 lua_pushstring(L, "path");
295 lua_pushstring(L, game.path.c_str());
296 lua_settable(L, top_lvl2);
298 lua_pushstring(L, "type");
299 lua_pushstring(L, "game");
300 lua_settable(L, top_lvl2);
302 lua_pushstring(L, "gamemods_path");
303 lua_pushstring(L, game.gamemods_path.c_str());
304 lua_settable(L, top_lvl2);
306 lua_pushstring(L, "name");
307 lua_pushstring(L, game.name.c_str());
308 lua_settable(L, top_lvl2);
310 lua_pushstring(L, "author");
311 lua_pushstring(L, game.author.c_str());
312 lua_settable(L, top_lvl2);
314 lua_pushstring(L, "release");
315 lua_pushinteger(L, game.release);
316 lua_settable(L, top_lvl2);
318 lua_pushstring(L, "menuicon_path");
319 lua_pushstring(L, game.menuicon_path.c_str());
320 lua_settable(L, top_lvl2);
322 lua_pushstring(L, "addon_mods_paths");
324 int table2 = lua_gettop(L);
325 int internal_index = 1;
326 for (const auto &addon_mods_path : game.addon_mods_paths) {
327 lua_pushnumber(L, internal_index);
328 lua_pushstring(L, addon_mods_path.second.c_str());
329 lua_settable(L, table2);
332 lua_settable(L, top_lvl2);
333 lua_settable(L, top);
339 /******************************************************************************/
340 int ModApiMainMenu::l_get_content_info(lua_State *L)
342 std::string path = luaL_checkstring(L, 1);
346 parseContentInfo(spec);
350 lua_pushstring(L, spec.name.c_str());
351 lua_setfield(L, -2, "name");
353 lua_pushstring(L, spec.type.c_str());
354 lua_setfield(L, -2, "type");
356 lua_pushstring(L, spec.author.c_str());
357 lua_setfield(L, -2, "author");
359 lua_pushinteger(L, spec.release);
360 lua_setfield(L, -2, "release");
362 lua_pushstring(L, spec.desc.c_str());
363 lua_setfield(L, -2, "description");
365 lua_pushstring(L, spec.path.c_str());
366 lua_setfield(L, -2, "path");
368 if (spec.type == "mod") {
371 parseModContents(spec);
376 for (const auto &dep : spec.depends) {
377 lua_pushstring(L, dep.c_str());
378 lua_rawseti(L, -2, i++);
380 lua_setfield(L, -2, "depends");
382 // Optional Dependencies
385 for (const auto &dep : spec.optdepends) {
386 lua_pushstring(L, dep.c_str());
387 lua_rawseti(L, -2, i++);
389 lua_setfield(L, -2, "optional_depends");
395 /******************************************************************************/
396 int ModApiMainMenu::l_show_keys_menu(lua_State *L)
398 GUIEngine* engine = getGuiEngine(L);
399 sanity_check(engine != NULL);
401 GUIKeyChangeMenu *kmenu = new GUIKeyChangeMenu(
402 engine->m_rendering_engine->get_gui_env(),
405 engine->m_menumanager,
406 engine->m_texture_source);
411 /******************************************************************************/
412 int ModApiMainMenu::l_create_world(lua_State *L)
414 const char *name = luaL_checkstring(L, 1);
415 int gameidx = luaL_checkinteger(L,2) -1;
417 StringMap use_settings;
418 luaL_checktype(L, 3, LUA_TTABLE);
420 while (lua_next(L, 3) != 0) {
421 // key at index -2 and value at index -1
422 use_settings[luaL_checkstring(L, -2)] = luaL_checkstring(L, -1);
427 std::string path = porting::path_user + DIR_DELIM
429 + sanitizeDirName(name, "world_");
431 std::vector<SubgameSpec> games = getAvailableGames();
432 if (gameidx < 0 || gameidx >= (int) games.size()) {
433 lua_pushstring(L, "Invalid game index");
437 // Set the settings for world creation
438 // this is a bad hack but the best we have right now..
440 for (auto it : use_settings) {
441 if (g_settings->existsLocal(it.first))
442 backup[it.first] = g_settings->get(it.first);
443 g_settings->set(it.first, it.second);
446 // Create world if it doesn't exist
448 loadGameConfAndInitWorld(path, name, games[gameidx], true);
450 } catch (const BaseException &e) {
451 auto err = std::string("Failed to initialize world: ") + e.what();
452 lua_pushstring(L, err.c_str());
455 // Restore previous settings
456 for (auto it : use_settings) {
457 auto it2 = backup.find(it.first);
458 if (it2 == backup.end())
459 g_settings->remove(it.first); // wasn't set before
461 g_settings->set(it.first, it2->second); // was set before
467 /******************************************************************************/
468 int ModApiMainMenu::l_delete_world(lua_State *L)
470 int world_id = luaL_checkinteger(L, 1) - 1;
471 std::vector<WorldSpec> worlds = getAvailableWorlds();
472 if (world_id < 0 || world_id >= (int) worlds.size()) {
473 lua_pushstring(L, "Invalid world index");
476 const WorldSpec &spec = worlds[world_id];
477 if (!fs::RecursiveDelete(spec.path)) {
478 lua_pushstring(L, "Failed to delete world");
484 /******************************************************************************/
485 int ModApiMainMenu::l_set_topleft_text(lua_State *L)
487 GUIEngine* engine = getGuiEngine(L);
488 sanity_check(engine != NULL);
492 if (!lua_isnone(L,1) && !lua_isnil(L,1))
493 text = luaL_checkstring(L, 1);
495 engine->setTopleftText(text);
499 /******************************************************************************/
500 int ModApiMainMenu::l_get_mapgen_names(lua_State *L)
502 std::vector<const char *> names;
503 bool include_hidden = lua_isboolean(L, 1) && readParam<bool>(L, 1);
504 Mapgen::getMapgenNames(&names, include_hidden);
507 for (size_t i = 0; i != names.size(); i++) {
508 lua_pushstring(L, names[i]);
509 lua_rawseti(L, -2, i + 1);
516 /******************************************************************************/
517 int ModApiMainMenu::l_get_user_path(lua_State *L)
519 std::string path = fs::RemoveRelativePathComponents(porting::path_user);
520 lua_pushstring(L, path.c_str());
524 /******************************************************************************/
525 int ModApiMainMenu::l_get_modpath(lua_State *L)
527 std::string modpath = fs::RemoveRelativePathComponents(
528 porting::path_user + DIR_DELIM + "mods" + DIR_DELIM);
529 lua_pushstring(L, modpath.c_str());
533 /******************************************************************************/
534 int ModApiMainMenu::l_get_modpaths(lua_State *L)
538 ModApiMainMenu::l_get_modpath(L);
539 lua_setfield(L, -2, "mods");
541 for (const std::string &component : getEnvModPaths()) {
542 lua_pushstring(L, component.c_str());
543 lua_setfield(L, -2, fs::AbsolutePath(component).c_str());
548 /******************************************************************************/
549 int ModApiMainMenu::l_get_clientmodpath(lua_State *L)
551 std::string modpath = fs::RemoveRelativePathComponents(
552 porting::path_user + DIR_DELIM + "clientmods" + DIR_DELIM);
553 lua_pushstring(L, modpath.c_str());
557 /******************************************************************************/
558 int ModApiMainMenu::l_get_gamepath(lua_State *L)
560 std::string gamepath = fs::RemoveRelativePathComponents(
561 porting::path_user + DIR_DELIM + "games" + DIR_DELIM);
562 lua_pushstring(L, gamepath.c_str());
566 /******************************************************************************/
567 int ModApiMainMenu::l_get_texturepath(lua_State *L)
569 std::string gamepath = fs::RemoveRelativePathComponents(
570 porting::path_user + DIR_DELIM + "textures");
571 lua_pushstring(L, gamepath.c_str());
575 /******************************************************************************/
576 int ModApiMainMenu::l_get_texturepath_share(lua_State *L)
578 std::string gamepath = fs::RemoveRelativePathComponents(
579 porting::path_share + DIR_DELIM + "textures");
580 lua_pushstring(L, gamepath.c_str());
584 /******************************************************************************/
585 int ModApiMainMenu::l_get_cache_path(lua_State *L)
587 lua_pushstring(L, fs::RemoveRelativePathComponents(porting::path_cache).c_str());
591 /******************************************************************************/
592 int ModApiMainMenu::l_get_temp_path(lua_State *L)
594 if (lua_isnoneornil(L, 1) || !lua_toboolean(L, 1))
595 lua_pushstring(L, fs::TempPath().c_str());
597 lua_pushstring(L, fs::CreateTempFile().c_str());
601 /******************************************************************************/
602 int ModApiMainMenu::l_create_dir(lua_State *L) {
603 const char *path = luaL_checkstring(L, 1);
605 if (ModApiMainMenu::mayModifyPath(path)) {
606 lua_pushboolean(L, fs::CreateAllDirs(path));
610 lua_pushboolean(L, false);
614 /******************************************************************************/
615 int ModApiMainMenu::l_delete_dir(lua_State *L)
617 const char *path = luaL_checkstring(L, 1);
619 std::string absolute_path = fs::RemoveRelativePathComponents(path);
621 if (ModApiMainMenu::mayModifyPath(absolute_path)) {
622 lua_pushboolean(L, fs::RecursiveDelete(absolute_path));
626 lua_pushboolean(L, false);
630 /******************************************************************************/
631 int ModApiMainMenu::l_copy_dir(lua_State *L)
633 const char *source = luaL_checkstring(L, 1);
634 const char *destination = luaL_checkstring(L, 2);
636 bool keep_source = true;
637 if (!lua_isnoneornil(L, 3))
638 keep_source = readParam<bool>(L, 3);
640 std::string abs_destination = fs::RemoveRelativePathComponents(destination);
641 std::string abs_source = fs::RemoveRelativePathComponents(source);
643 if (!ModApiMainMenu::mayModifyPath(abs_destination) ||
644 (!keep_source && !ModApiMainMenu::mayModifyPath(abs_source))) {
645 lua_pushboolean(L, false);
651 retval = fs::CopyDir(abs_source, abs_destination);
653 retval = fs::MoveDir(abs_source, abs_destination);
654 lua_pushboolean(L, retval);
658 /******************************************************************************/
659 int ModApiMainMenu::l_is_dir(lua_State *L)
661 const char *path = luaL_checkstring(L, 1);
663 lua_pushboolean(L, fs::IsDir(path));
667 /******************************************************************************/
668 int ModApiMainMenu::l_extract_zip(lua_State *L)
670 const char *zipfile = luaL_checkstring(L, 1);
671 const char *destination = luaL_checkstring(L, 2);
673 std::string absolute_destination = fs::RemoveRelativePathComponents(destination);
675 if (ModApiMainMenu::mayModifyPath(absolute_destination)) {
676 auto fs = RenderingEngine::get_raw_device()->getFileSystem();
677 bool ok = fs::extractZipFile(fs, zipfile, destination);
678 lua_pushboolean(L, ok);
682 lua_pushboolean(L,false);
686 /******************************************************************************/
687 int ModApiMainMenu::l_get_mainmenu_path(lua_State *L)
689 GUIEngine* engine = getGuiEngine(L);
690 sanity_check(engine != NULL);
692 lua_pushstring(L,engine->getScriptDir().c_str());
696 /******************************************************************************/
697 bool ModApiMainMenu::mayModifyPath(std::string path)
699 path = fs::RemoveRelativePathComponents(path);
701 if (fs::PathStartsWith(path, fs::TempPath()))
704 std::string path_user = fs::RemoveRelativePathComponents(porting::path_user);
706 if (fs::PathStartsWith(path, path_user + DIR_DELIM "client"))
708 if (fs::PathStartsWith(path, path_user + DIR_DELIM "clientmods"))
710 if (fs::PathStartsWith(path, path_user + DIR_DELIM "textures"))
712 if (fs::PathStartsWith(path, path_user + DIR_DELIM "games"))
714 if (fs::PathStartsWith(path, path_user + DIR_DELIM "mods"))
716 if (fs::PathStartsWith(path, path_user + DIR_DELIM "textures"))
718 if (fs::PathStartsWith(path, path_user + DIR_DELIM "worlds"))
721 if (fs::PathStartsWith(path, fs::RemoveRelativePathComponents(porting::path_cache)))
728 /******************************************************************************/
729 int ModApiMainMenu::l_may_modify_path(lua_State *L)
731 const char *target = luaL_checkstring(L, 1);
732 std::string absolute_destination = fs::RemoveRelativePathComponents(target);
733 lua_pushboolean(L, ModApiMainMenu::mayModifyPath(absolute_destination));
737 /******************************************************************************/
738 int ModApiMainMenu::l_show_path_select_dialog(lua_State *L)
740 GUIEngine* engine = getGuiEngine(L);
741 sanity_check(engine != NULL);
743 const char *formname= luaL_checkstring(L, 1);
744 const char *title = luaL_checkstring(L, 2);
745 bool is_file_select = readParam<bool>(L, 3);
747 GUIFileSelectMenu* fileOpenMenu =
748 new GUIFileSelectMenu(engine->m_rendering_engine->get_gui_env(),
751 engine->m_menumanager,
755 fileOpenMenu->setTextDest(engine->m_buttonhandler);
756 fileOpenMenu->drop();
760 /******************************************************************************/
761 int ModApiMainMenu::l_download_file(lua_State *L)
763 const char *url = luaL_checkstring(L, 1);
764 const char *target = luaL_checkstring(L, 2);
767 std::string absolute_destination = fs::RemoveRelativePathComponents(target);
769 if (ModApiMainMenu::mayModifyPath(absolute_destination)) {
770 if (GUIEngine::downloadFile(url,absolute_destination)) {
771 lua_pushboolean(L,true);
775 errorstream << "DOWNLOAD denied: " << absolute_destination
776 << " isn't a allowed path" << std::endl;
778 lua_pushboolean(L,false);
782 /******************************************************************************/
783 int ModApiMainMenu::l_get_video_drivers(lua_State *L)
785 std::vector<irr::video::E_DRIVER_TYPE> drivers = RenderingEngine::getSupportedVideoDrivers();
788 for (u32 i = 0; i != drivers.size(); i++) {
789 auto &info = RenderingEngine::getVideoDriverInfo(drivers[i]);
792 lua_pushstring(L, info.name.c_str());
793 lua_setfield(L, -2, "name");
794 lua_pushstring(L, info.friendly_name.c_str());
795 lua_setfield(L, -2, "friendly_name");
797 lua_rawseti(L, -2, i + 1);
803 /******************************************************************************/
804 int ModApiMainMenu::l_gettext(lua_State *L)
806 const char *srctext = luaL_checkstring(L, 1);
807 const char *text = *srctext ? gettext(srctext) : "";
808 lua_pushstring(L, text);
813 /******************************************************************************/
814 int ModApiMainMenu::l_get_screen_info(lua_State *L)
817 int top = lua_gettop(L);
818 lua_pushstring(L,"density");
819 lua_pushnumber(L,RenderingEngine::getDisplayDensity());
820 lua_settable(L, top);
822 const v2u32 &window_size = RenderingEngine::getWindowSize();
823 lua_pushstring(L,"window_width");
824 lua_pushnumber(L, window_size.X);
825 lua_settable(L, top);
827 lua_pushstring(L,"window_height");
828 lua_pushnumber(L, window_size.Y);
829 lua_settable(L, top);
831 lua_pushstring(L, "render_info");
832 lua_pushstring(L, wide_to_utf8(RenderingEngine::get_video_driver()->getName()).c_str());
833 lua_settable(L, top);
837 /******************************************************************************/
838 int ModApiMainMenu::l_get_min_supp_proto(lua_State *L)
840 lua_pushinteger(L, CLIENT_PROTOCOL_VERSION_MIN);
844 int ModApiMainMenu::l_get_max_supp_proto(lua_State *L)
846 lua_pushinteger(L, CLIENT_PROTOCOL_VERSION_MAX);
850 /******************************************************************************/
851 int ModApiMainMenu::l_open_url(lua_State *L)
853 std::string url = luaL_checkstring(L, 1);
854 lua_pushboolean(L, porting::open_url(url));
858 /******************************************************************************/
859 int ModApiMainMenu::l_open_dir(lua_State *L)
861 std::string path = luaL_checkstring(L, 1);
862 lua_pushboolean(L, porting::open_directory(path));
866 /******************************************************************************/
867 int ModApiMainMenu::l_do_async_callback(lua_State *L)
869 MainMenuScripting *script = getScriptApi<MainMenuScripting>(L);
871 size_t func_length, param_length;
872 const char* serialized_func_raw = luaL_checklstring(L, 1, &func_length);
873 const char* serialized_param_raw = luaL_checklstring(L, 2, ¶m_length);
875 sanity_check(serialized_func_raw != NULL);
876 sanity_check(serialized_param_raw != NULL);
878 u32 jobId = script->queueAsync(
879 std::string(serialized_func_raw, func_length),
880 std::string(serialized_param_raw, param_length));
882 lua_pushinteger(L, jobId);
887 /******************************************************************************/
888 void ModApiMainMenu::Initialize(lua_State *L, int top)
890 API_FCT(update_formspec);
891 API_FCT(set_formspec_prepend);
893 API_FCT(get_textlist_index);
894 API_FCT(get_table_index);
897 API_FCT(get_content_info);
900 API_FCT(show_keys_menu);
901 API_FCT(create_world);
902 API_FCT(delete_world);
903 API_FCT(set_background);
904 API_FCT(set_topleft_text);
905 API_FCT(get_mapgen_names);
906 API_FCT(get_user_path);
907 API_FCT(get_modpath);
908 API_FCT(get_modpaths);
909 API_FCT(get_clientmodpath);
910 API_FCT(get_gamepath);
911 API_FCT(get_texturepath);
912 API_FCT(get_texturepath_share);
913 API_FCT(get_cache_path);
914 API_FCT(get_temp_path);
919 API_FCT(extract_zip);
920 API_FCT(may_modify_path);
921 API_FCT(get_mainmenu_path);
922 API_FCT(show_path_select_dialog);
923 API_FCT(download_file);
925 API_FCT(get_video_drivers);
926 API_FCT(get_screen_info);
927 API_FCT(get_min_supp_proto);
928 API_FCT(get_max_supp_proto);
931 API_FCT(do_async_callback);
934 /******************************************************************************/
935 void ModApiMainMenu::InitializeAsync(lua_State *L, int top)
939 API_FCT(get_mapgen_names);
940 API_FCT(get_user_path);
941 API_FCT(get_modpath);
942 API_FCT(get_modpaths);
943 API_FCT(get_clientmodpath);
944 API_FCT(get_gamepath);
945 API_FCT(get_texturepath);
946 API_FCT(get_texturepath_share);
947 API_FCT(get_cache_path);
948 API_FCT(get_temp_path);
953 API_FCT(extract_zip);
954 API_FCT(may_modify_path);
955 API_FCT(download_file);
956 API_FCT(get_min_supp_proto);
957 API_FCT(get_max_supp_proto);