Minetest  5.4.0
ModApiMainMenu Class Reference

Implementation of lua api support for mainmenu. More...

#include <l_mainmenu.h>

+ Inheritance diagram for ModApiMainMenu:
+ Collaboration diagram for ModApiMainMenu:

Static Public Member Functions

static void Initialize (lua_State *L, int top)
 initialize this API module More...
 
static void InitializeAsync (lua_State *L, int top)
 
- Static Public Member Functions inherited from ModApiBase
static ScriptApiBasegetScriptApiBase (lua_State *L)
 
static ServergetServer (lua_State *L)
 
static ServerInventoryManagergetServerInventoryMgr (lua_State *L)
 
static ClientgetClient (lua_State *L)
 
static GUIEnginegetGuiEngine (lua_State *L)
 
static IGameDefgetGameDef (lua_State *L)
 
static EnvironmentgetEnv (lua_State *L)
 
static std::string getCurrentModPath (lua_State *L)
 
template<typename T >
static T * getScriptApi (lua_State *L)
 
static bool registerFunction (lua_State *L, const char *name, lua_CFunction func, int top)
 
static int l_deprecated_function (lua_State *L, const char *good, const char *bad, lua_CFunction func)
 A wrapper for deprecated functions. More...
 

Static Private Member Functions

static std::string getTextData (lua_State *L, std::string name)
 read a text variable from gamedata table within lua stack More...
 
static int getIntegerData (lua_State *L, std::string name, bool &valid)
 read a integer variable from gamedata table within lua stack More...
 
static int getBoolData (lua_State *L, std::string name, bool &valid)
 read a bool variable from gamedata table within lua stack More...
 
static bool mayModifyPath (const std::string &path)
 Checks if a path may be modified. More...
 
static int l_start (lua_State *L)
 
static int l_close (lua_State *L)
 
static int l_create_world (lua_State *L)
 
static int l_delete_world (lua_State *L)
 
static int l_get_worlds (lua_State *L)
 
static int l_get_mapgen_names (lua_State *L)
 
static int l_gettext (lua_State *L)
 
static int l_get_games (lua_State *L)
 
static int l_get_content_info (lua_State *L)
 
static int l_show_keys_menu (lua_State *L)
 
static int l_show_path_select_dialog (lua_State *L)
 
static int l_set_topleft_text (lua_State *L)
 
static int l_set_clouds (lua_State *L)
 
static int l_get_textlist_index (lua_State *L)
 
static int l_get_table_index (lua_State *L)
 
static int l_set_background (lua_State *L)
 
static int l_update_formspec (lua_State *L)
 
static int l_set_formspec_prepend (lua_State *L)
 
static int l_get_screen_info (lua_State *L)
 
static int l_get_mainmenu_path (lua_State *L)
 
static int l_get_user_path (lua_State *L)
 
static int l_get_modpath (lua_State *L)
 
static int l_get_clientmodpath (lua_State *L)
 
static int l_get_gamepath (lua_State *L)
 
static int l_get_texturepath (lua_State *L)
 
static int l_get_texturepath_share (lua_State *L)
 
static int l_get_cache_path (lua_State *L)
 
static int l_get_temp_path (lua_State *L)
 
static int l_create_dir (lua_State *L)
 
static int l_delete_dir (lua_State *L)
 
static int l_copy_dir (lua_State *L)
 
static int l_is_dir (lua_State *L)
 
static int l_extract_zip (lua_State *L)
 
static int l_may_modify_path (lua_State *L)
 
static int l_download_file (lua_State *L)
 
static int l_get_video_drivers (lua_State *L)
 
static int l_get_video_modes (lua_State *L)
 
static int l_get_min_supp_proto (lua_State *L)
 
static int l_get_max_supp_proto (lua_State *L)
 
static int l_open_url (lua_State *L)
 
static int l_open_dir (lua_State *L)
 
static int l_do_async_callback (lua_State *L)
 

Additional Inherited Members

- Protected Member Functions inherited from LuaHelper
template<>
bool readParam (lua_State *L, int index)
 
- Static Protected Member Functions inherited from LuaHelper
static bool isNaN (lua_State *L, int idx)
 
template<typename T >
static T readParam (lua_State *L, int index)
 Read a value using a template type T from Lua State L and index. More...
 
template<typename T >
static T readParam (lua_State *L, int index, const T &default_value)
 Read a value using a template type T from Lua State L and index. More...
 

Detailed Description

Implementation of lua api support for mainmenu.

Member Function Documentation

◆ getBoolData()

int ModApiMainMenu::getBoolData ( lua_State *  L,
std::string  name,
bool &  valid 
)
staticprivate

read a bool variable from gamedata table within lua stack

Parameters
Lstack to read variable from
namename of variable to read
Returns
bool value of requested variable

Referenced by l_start().

+ Here is the caller graph for this function:

◆ getIntegerData()

int ModApiMainMenu::getIntegerData ( lua_State *  L,
std::string  name,
bool &  valid 
)
staticprivate

read a integer variable from gamedata table within lua stack

Parameters
Lstack to read variable from
namename of variable to read
Returns
integer value of requested variable

Referenced by l_start().

+ Here is the caller graph for this function:

◆ getTextData()

std::string ModApiMainMenu::getTextData ( lua_State *  L,
std::string  name 
)
staticprivate

read a text variable from gamedata table within lua stack

Parameters
Lstack to read variable from
namename of variable to read
Returns
string value of requested variable

Referenced by l_start().

+ Here is the caller graph for this function:

◆ Initialize()

void ModApiMainMenu::Initialize ( lua_State *  L,
int  top 
)
static

initialize this API module

Parameters
Llua stack to initialize
topindex (in lua stack) of global API table

References API_FCT, and porting::open_url().

Referenced by MainMenuScripting::initializeModApi().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InitializeAsync()

void ModApiMainMenu::InitializeAsync ( lua_State *  L,
int  top 
)
static

References API_FCT.

Referenced by MainMenuScripting::initializeModApi().

+ Here is the caller graph for this function:

◆ l_close()

int ModApiMainMenu::l_close ( lua_State *  L)
staticprivate

References ModApiBase::getGuiEngine(), GUIEngine::m_kill, and sanity_check.

+ Here is the call graph for this function:

◆ l_copy_dir()

int ModApiMainMenu::l_copy_dir ( lua_State *  L)
staticprivate

References fs::CopyDir(), mayModifyPath(), fs::RecursiveDelete(), and fs::RemoveRelativePathComponents().

+ Here is the call graph for this function:

◆ l_create_dir()

int ModApiMainMenu::l_create_dir ( lua_State *  L)
staticprivate

References fs::CreateAllDirs(), and mayModifyPath().

+ Here is the call graph for this function:

◆ l_create_world()

int ModApiMainMenu::l_create_world ( lua_State *  L)
staticprivate

References DIR_DELIM, getAvailableGames(), loadGameConfAndInitWorld(), porting::path_user, sanitizeDirName(), and BaseException::what().

+ Here is the call graph for this function:

◆ l_delete_dir()

int ModApiMainMenu::l_delete_dir ( lua_State *  L)
staticprivate

References mayModifyPath(), fs::RecursiveDelete(), and fs::RemoveRelativePathComponents().

+ Here is the call graph for this function:

◆ l_delete_world()

int ModApiMainMenu::l_delete_world ( lua_State *  L)
staticprivate

References getAvailableWorlds(), WorldSpec::path, and fs::RecursiveDelete().

+ Here is the call graph for this function:

◆ l_do_async_callback()

int ModApiMainMenu::l_do_async_callback ( lua_State *  L)
staticprivate

References ModApiBase::getGuiEngine(), GUIEngine::queueAsync(), and sanity_check.

+ Here is the call graph for this function:

◆ l_download_file()

int ModApiMainMenu::l_download_file ( lua_State *  L)
staticprivate

References GUIEngine::downloadFile(), errorstream, mayModifyPath(), and fs::RemoveRelativePathComponents().

+ Here is the call graph for this function:

◆ l_extract_zip()

int ModApiMainMenu::l_extract_zip ( lua_State *  L)
staticprivate

References fs::CreateAllDirs(), DIR_DELIM, RenderingEngine::get_filesystem(), mayModifyPath(), fs::PathExists(), fs::RemoveLastPathComponent(), fs::RemoveRelativePathComponents(), and sanity_check.

+ Here is the call graph for this function:

◆ l_get_cache_path()

int ModApiMainMenu::l_get_cache_path ( lua_State *  L)
staticprivate

References porting::path_cache, and fs::RemoveRelativePathComponents().

+ Here is the call graph for this function:

◆ l_get_clientmodpath()

int ModApiMainMenu::l_get_clientmodpath ( lua_State *  L)
staticprivate

References DIR_DELIM, porting::path_user, and fs::RemoveRelativePathComponents().

+ Here is the call graph for this function:

◆ l_get_content_info()

int ModApiMainMenu::l_get_content_info ( lua_State *  L)
staticprivate

References ContentSpec::author, ModSpec::depends, ContentSpec::desc, ContentSpec::name, ModSpec::optdepends, parseContentInfo(), parseModContents(), ContentSpec::path, ModSpec::path, ContentSpec::release, and ContentSpec::type.

+ Here is the call graph for this function:

◆ l_get_gamepath()

int ModApiMainMenu::l_get_gamepath ( lua_State *  L)
staticprivate

References DIR_DELIM, porting::path_user, and fs::RemoveRelativePathComponents().

+ Here is the call graph for this function:

◆ l_get_games()

int ModApiMainMenu::l_get_games ( lua_State *  L)
staticprivate

References getAvailableGames().

+ Here is the call graph for this function:

◆ l_get_mainmenu_path()

int ModApiMainMenu::l_get_mainmenu_path ( lua_State *  L)
staticprivate

References ModApiBase::getGuiEngine(), GUIEngine::getScriptDir(), and sanity_check.

+ Here is the call graph for this function:

◆ l_get_mapgen_names()

int ModApiMainMenu::l_get_mapgen_names ( lua_State *  L)
staticprivate

References Mapgen::getMapgenNames().

+ Here is the call graph for this function:

◆ l_get_max_supp_proto()

int ModApiMainMenu::l_get_max_supp_proto ( lua_State *  L)
staticprivate

◆ l_get_min_supp_proto()

int ModApiMainMenu::l_get_min_supp_proto ( lua_State *  L)
staticprivate

◆ l_get_modpath()

int ModApiMainMenu::l_get_modpath ( lua_State *  L)
staticprivate

References DIR_DELIM, porting::path_user, and fs::RemoveRelativePathComponents().

+ Here is the call graph for this function:

◆ l_get_screen_info()

int ModApiMainMenu::l_get_screen_info ( lua_State *  L)
staticprivate

References RenderingEngine::get_instance(), RenderingEngine::getDisplayDensity(), RenderingEngine::getDisplaySize(), and RenderingEngine::getWindowSize().

+ Here is the call graph for this function:

◆ l_get_table_index()

int ModApiMainMenu::l_get_table_index ( lua_State *  L)
staticprivate

References ModApiBase::getGuiEngine(), GUIFormSpecMenu::getTable(), GUIEngine::m_menu, sanity_check, and table.

Referenced by l_get_textlist_index().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ l_get_temp_path()

int ModApiMainMenu::l_get_temp_path ( lua_State *  L)
staticprivate

References fs::TempPath().

+ Here is the call graph for this function:

◆ l_get_textlist_index()

int ModApiMainMenu::l_get_textlist_index ( lua_State *  L)
staticprivate

References l_get_table_index().

+ Here is the call graph for this function:

◆ l_get_texturepath()

int ModApiMainMenu::l_get_texturepath ( lua_State *  L)
staticprivate

References DIR_DELIM, porting::path_user, and fs::RemoveRelativePathComponents().

+ Here is the call graph for this function:

◆ l_get_texturepath_share()

int ModApiMainMenu::l_get_texturepath_share ( lua_State *  L)
staticprivate

References DIR_DELIM, porting::path_share, and fs::RemoveRelativePathComponents().

+ Here is the call graph for this function:

◆ l_get_user_path()

int ModApiMainMenu::l_get_user_path ( lua_State *  L)
staticprivate

References porting::path_user, and fs::RemoveRelativePathComponents().

+ Here is the call graph for this function:

◆ l_get_video_drivers()

int ModApiMainMenu::l_get_video_drivers ( lua_State *  L)
staticprivate

References RenderingEngine::getSupportedVideoDrivers(), RenderingEngine::getVideoDriverFriendlyName(), and RenderingEngine::getVideoDriverName().

+ Here is the call graph for this function:

◆ l_get_video_modes()

int ModApiMainMenu::l_get_video_modes ( lua_State *  L)
staticprivate

References RenderingEngine::getSupportedVideoModes().

+ Here is the call graph for this function:

◆ l_get_worlds()

int ModApiMainMenu::l_get_worlds ( lua_State *  L)
staticprivate

References getAvailableWorlds().

+ Here is the call graph for this function:

◆ l_gettext()

int ModApiMainMenu::l_gettext ( lua_State *  L)
staticprivate

References strgettext().

+ Here is the call graph for this function:

◆ l_is_dir()

int ModApiMainMenu::l_is_dir ( lua_State *  L)
staticprivate

References fs::IsDir().

+ Here is the call graph for this function:

◆ l_may_modify_path()

int ModApiMainMenu::l_may_modify_path ( lua_State *  L)
staticprivate

References mayModifyPath(), and fs::RemoveRelativePathComponents().

+ Here is the call graph for this function:

◆ l_open_dir()

int ModApiMainMenu::l_open_dir ( lua_State *  L)
staticprivate

References porting::open_directory().

+ Here is the call graph for this function:

◆ l_open_url()

int ModApiMainMenu::l_open_url ( lua_State *  L)
staticprivate

References porting::open_url().

+ Here is the call graph for this function:

◆ l_set_background()

int ModApiMainMenu::l_set_background ( lua_State *  L)
staticprivate

References ModApiBase::getGuiEngine(), sanity_check, GUIEngine::setTexture(), TEX_LAYER_BACKGROUND, TEX_LAYER_FOOTER, TEX_LAYER_HEADER, and TEX_LAYER_OVERLAY.

+ Here is the call graph for this function:

◆ l_set_clouds()

int ModApiMainMenu::l_set_clouds ( lua_State *  L)
staticprivate

References ModApiBase::getGuiEngine(), GUIEngine::m_clouds_enabled, and sanity_check.

+ Here is the call graph for this function:

◆ l_set_formspec_prepend()

int ModApiMainMenu::l_set_formspec_prepend ( lua_State *  L)
staticprivate

References ModApiBase::getGuiEngine(), GUIEngine::m_startgame, sanity_check, and GUIEngine::setFormspecPrepend().

+ Here is the call graph for this function:

◆ l_set_topleft_text()

int ModApiMainMenu::l_set_topleft_text ( lua_State *  L)
staticprivate

References ModApiBase::getGuiEngine(), sanity_check, and GUIEngine::setTopleftText().

+ Here is the call graph for this function:

◆ l_show_keys_menu()

int ModApiMainMenu::l_show_keys_menu ( lua_State *  L)
staticprivate

References RenderingEngine::get_gui_env(), ModApiBase::getGuiEngine(), GUIEngine::m_menumanager, GUIEngine::m_parent, GUIEngine::m_texture_source, and sanity_check.

+ Here is the call graph for this function:

◆ l_show_path_select_dialog()

int ModApiMainMenu::l_show_path_select_dialog ( lua_State *  L)
staticprivate

References RenderingEngine::get_gui_env(), ModApiBase::getGuiEngine(), GUIEngine::m_buttonhandler, GUIEngine::m_menumanager, GUIEngine::m_parent, sanity_check, and GUIFileSelectMenu::setTextDest().

+ Here is the call graph for this function:

◆ l_start()

int ModApiMainMenu::l_start ( lua_State *  L)
staticprivate

◆ l_update_formspec()

int ModApiMainMenu::l_update_formspec ( lua_State *  L)
staticprivate

References ModApiBase::getGuiEngine(), GUIEngine::m_formspecgui, GUIEngine::m_startgame, sanity_check, and FormspecFormSource::setForm().

+ Here is the call graph for this function:

◆ mayModifyPath()

bool ModApiMainMenu::mayModifyPath ( const std::string &  path)
staticprivate

Checks if a path may be modified.

Paths in the temp directory or the user games, mods, textures, or worlds directories may be modified.

Parameters
pathpath to check
Returns
true if the path may be modified

References DIR_DELIM, porting::path_cache, porting::path_user, fs::PathStartsWith(), fs::RemoveRelativePathComponents(), and fs::TempPath().

Referenced by l_copy_dir(), l_create_dir(), l_delete_dir(), l_download_file(), l_extract_zip(), and l_may_modify_path().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: