Luanti 5.16.0-dev
Loading...
Searching...
No Matches
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
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 EmergeThreadgetEmergeThread (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)
template<typename T>
static void registerClass (lua_State *L, const luaL_Reg *methods, const luaL_Reg *metamethods)
template<typename T>
static T * checkObject (lua_State *L, int narg)
static int l_deprecated_function (lua_State *L, const char *good, const char *bad, lua_CFunction func)
 A wrapper for deprecated functions.

Static Private Member Functions

static std::string getTextData (lua_State *L, const std::string &name)
 read a text variable from gamedata table within lua stack
static int getIntegerData (lua_State *L, const std::string &name, bool &valid)
 read an integer variable from gamedata table within lua stack
static int getBoolData (lua_State *L, const std::string &name, bool &valid)
 read a bool variable from gamedata table within lua stack
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_get_language (lua_State *L)
static int l_get_games (lua_State *L)
static int l_get_content_info (lua_State *L)
static int l_get_mod_list (lua_State *L)
static int l_check_mod_configuration (lua_State *L)
static int l_get_content_translation (lua_State *L)
static int l_show_touchscreen_layout (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_set_clouds_color (lua_State *L)
static int l_set_sky_color (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_window_info (lua_State *L)
static int l_get_active_renderer (lua_State *L)
static int l_get_active_irrlicht_device (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_modpaths (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_min_supp_proto (lua_State *L)
static int l_get_max_supp_proto (lua_State *L)
static int l_get_formspec_version (lua_State *L)
static int l_is_debug_build (lua_State *L)
static int l_open_url (lua_State *L)
static int l_open_url_dialog (lua_State *L)
static int l_open_dir (lua_State *L)
static int l_share_file (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)
template<>
s16 readParam (lua_State *L, int index)
template<>
int readParam (lua_State *L, int index)
template<>
float readParam (lua_State *L, int index)
template<>
v2s16 readParam (lua_State *L, int index)
template<>
v2f readParam (lua_State *L, int index)
template<>
v3f readParam (lua_State *L, int index)
template<>
std::string_view readParam (lua_State *L, int index)
template<>
std::string readParam (lua_State *L, int index)
template<>
std::string_view readParam (lua_State *L, int index)
 Read a string from Lua state L at index without copying it.
Static Protected Member Functions inherited from LuaHelper
template<typename T>
static T readParam (lua_State *L, int index)
 Read a value using a template type T from Lua state L at index.
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 at index.

Detailed Description

Implementation of lua api support for mainmenu.

Member Function Documentation

◆ getBoolData()

int ModApiMainMenu::getBoolData ( lua_State * L,
const 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

References LuaHelper::readParam().

Referenced by l_start().

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

◆ getIntegerData()

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

read an 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,
const 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 g_first_run.

Referenced by MainMenuScripting::initializeModApi().

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_check_mod_configuration()

◆ l_close()

int ModApiMainMenu::l_close ( lua_State * L)
staticprivate

References GUIEngine::m_kill, and sanity_check.

◆ l_copy_dir()

int ModApiMainMenu::l_copy_dir ( lua_State * L)
staticprivate

References CHECK_SECURE_PATH, fs::CopyDir(), fs::MoveDir(), and LuaHelper::readParam().

Here is the call graph for this function:

◆ l_create_dir()

int ModApiMainMenu::l_create_dir ( lua_State * L)
staticprivate

References CHECK_SECURE_PATH, and fs::CreateAllDirs().

Here is the call graph for this function:

◆ l_create_world()

int ModApiMainMenu::l_create_world ( lua_State * L)
staticprivate

References DIR_DELIM, g_settings, 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 CHECK_SECURE_PATH, and fs::RecursiveDelete().

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 call_string_dump(), ModApiBase::getScriptApi(), and MainMenuScripting::queueAsync().

Here is the call graph for this function:

◆ l_download_file()

int ModApiMainMenu::l_download_file ( lua_State * L)
staticprivate

References CHECK_SECURE_PATH, and GUIEngine::downloadFile().

Here is the call graph for this function:

◆ l_extract_zip()

int ModApiMainMenu::l_extract_zip ( lua_State * L)
staticprivate

References CHECK_SECURE_PATH, and RenderingEngine::get_raw_device().

Here is the call graph for this function:

◆ l_get_active_irrlicht_device()

int ModApiMainMenu::l_get_active_irrlicht_device ( lua_State * L)
staticprivate

References RenderingEngine::get_raw_device().

Here is the call graph for this function:

◆ l_get_active_renderer()

int ModApiMainMenu::l_get_active_renderer ( lua_State * L)
staticprivate

References RenderingEngine::get_video_driver().

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, CHECK_SECURE_PATH, ModSpec::depends, ContentSpec::desc, ContentSpec::name, ModSpec::optdepends, parseContentInfo(), parseModContents(), ContentSpec::path, ModSpec::path, ContentSpec::release, ContentSpec::textdomain, ContentSpec::title, ContentSpec::type, and warningstream.

Here is the call graph for this function:

◆ l_get_content_translation()

int ModApiMainMenu::l_get_content_translation ( lua_State * L)
staticprivate

References GUIEngine::getContentTranslations(), sanity_check, translate_string(), utf8_to_wide(), and wide_to_utf8().

Here is the call graph for this function:

◆ l_get_formspec_version()

int ModApiMainMenu::l_get_formspec_version ( lua_State * L)
staticprivate

References FORMSPEC_API_VERSION.

◆ 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 DIR_DELIM, getAvailableGames(), and getImagePath().

Here is the call graph for this function:

◆ l_get_language()

int ModApiMainMenu::l_get_language ( lua_State * L)
staticprivate

◆ l_get_mainmenu_path()

int ModApiMainMenu::l_get_mainmenu_path ( lua_State * L)
staticprivate

References 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(), and LuaHelper::readParam().

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_mod_list()

int ModApiMainMenu::l_get_mod_list ( lua_State * L)
staticprivate

References CHECK_SECURE_PATH, flattenMods(), getModsInPath(), and push_mod_spec().

Here is the call graph for this function:

◆ l_get_modpath()

int ModApiMainMenu::l_get_modpath ( lua_State * L)
staticprivate

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

Referenced by l_get_modpaths().

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

◆ l_get_modpaths()

int ModApiMainMenu::l_get_modpaths ( lua_State * L)
staticprivate

References fs::AbsolutePath(), DIR_DELIM, getEnvModPaths(), l_get_modpath(), porting::path_share, porting::path_user, and fs::RemoveRelativePathComponents().

Here is the call graph for this function:

◆ l_get_table_index()

int ModApiMainMenu::l_get_table_index ( lua_State * L)
staticprivate

References GUIEngine::m_menu, sanity_check, and table.

Referenced by l_get_textlist_index().

Here is the caller graph for this function:

◆ l_get_temp_path()

int ModApiMainMenu::l_get_temp_path ( lua_State * L)
staticprivate

References fs::CreateTempDir(), and fs::CreateTempFile().

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_window_info()

int ModApiMainMenu::l_get_window_info ( lua_State * L)
staticprivate

References push_v2f(), and push_v2u32().

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_is_debug_build()

int ModApiMainMenu::l_is_debug_build ( lua_State * L)
staticprivate

◆ l_is_dir()

int ModApiMainMenu::l_is_dir ( lua_State * L)
staticprivate

References CHECK_SECURE_PATH, and 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 ScriptApiSecurity::checkPath().

Here is the call graph for this function:

◆ l_open_dir()

int ModApiMainMenu::l_open_dir ( lua_State * L)
staticprivate

References CHECK_SECURE_PATH, and 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_open_url_dialog()

int ModApiMainMenu::l_open_url_dialog ( lua_State * L)
staticprivate

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

Here is the call graph for this function:

◆ l_set_background()

int ModApiMainMenu::l_set_background ( lua_State * L)
staticprivate

References LuaHelper::readParam(), 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 GUIEngine::m_clouds_enabled, LuaHelper::readParam(), and sanity_check.

Here is the call graph for this function:

◆ l_set_clouds_color()

int ModApiMainMenu::l_set_clouds_color ( lua_State * L)
staticprivate

References parseColorString(), LuaHelper::readParam(), sanity_check, and GUIEngine::setMenuCloudsColor().

Here is the call graph for this function:

◆ l_set_formspec_prepend()

int ModApiMainMenu::l_set_formspec_prepend ( lua_State * L)
staticprivate

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

Here is the call graph for this function:

◆ l_set_sky_color()

int ModApiMainMenu::l_set_sky_color ( lua_State * L)
staticprivate

References parseColorString(), LuaHelper::readParam(), sanity_check, and GUIEngine::setMenuSkyColor().

Here is the call graph for this function:

◆ l_set_topleft_text()

int ModApiMainMenu::l_set_topleft_text ( lua_State * L)
staticprivate

References sanity_check, and GUIEngine::setTopleftText().

Here is the call graph for this function:

◆ l_share_file()

int ModApiMainMenu::l_share_file ( lua_State * L)
staticprivate

References CHECK_SECURE_PATH, and porting::shareFileAndroid().

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(), GUIEngine::m_buttonhandler, GUIEngine::m_menumanager, GUIEngine::m_parent, GUIEngine::m_rendering_engine, LuaHelper::readParam(), sanity_check, and GUIFileSelectMenu::setTextDest().

Here is the call graph for this function:

◆ l_show_touchscreen_layout()

int ModApiMainMenu::l_show_touchscreen_layout ( lua_State * L)
staticprivate

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

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 GUIEngine::m_formspecgui, GUIEngine::m_startgame, sanity_check, and FormspecFormSource::setForm().

Here is the call graph for this function:

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