aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorElijah Duffy <enduffy2014@outlook.com>2017-06-06 05:34:31 -0700
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-06-06 14:34:31 +0200
commitfee5171298606d928d0f718d8ec0eeb2cacc1e71 (patch)
tree68a73cebd3b4e676d1469287f175674aca780c7d /src
parentb3dfe5332cd345c7f33b8a3828649122145f7a12 (diff)
downloadminetest-fee5171298606d928d0f718d8ec0eeb2cacc1e71.tar.gz
minetest-fee5171298606d928d0f718d8ec0eeb2cacc1e71.tar.bz2
minetest-fee5171298606d928d0f718d8ec0eeb2cacc1e71.zip
Main Menu: Add get_clientmodpath API (#5912)
Add `core.get_clientmodpath` to main menu API (also possible in async calls).
Diffstat (limited to 'src')
-rw-r--r--src/script/lua_api/l_mainmenu.cpp12
-rw-r--r--src/script/lua_api/l_mainmenu.h2
2 files changed, 13 insertions, 1 deletions
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp
index dc8654960..388971814 100644
--- a/src/script/lua_api/l_mainmenu.cpp
+++ b/src/script/lua_api/l_mainmenu.cpp
@@ -735,6 +735,15 @@ int ModApiMainMenu::l_get_modpath(lua_State *L)
}
/******************************************************************************/
+int ModApiMainMenu::l_get_clientmodpath(lua_State *L)
+{
+ std::string modpath = fs::RemoveRelativePathComponents(
+ porting::path_user + DIR_DELIM + "clientmods" + DIR_DELIM);
+ lua_pushstring(L, modpath.c_str());
+ return 1;
+}
+
+/******************************************************************************/
int ModApiMainMenu::l_get_gamepath(lua_State *L)
{
std::string gamepath = fs::RemoveRelativePathComponents(
@@ -1120,6 +1129,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
API_FCT(set_topleft_text);
API_FCT(get_mapgen_names);
API_FCT(get_modpath);
+ API_FCT(get_clientmodpath);
API_FCT(get_gamepath);
API_FCT(get_texturepath);
API_FCT(get_texturepath_share);
@@ -1150,6 +1160,7 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top)
API_FCT(get_favorites);
API_FCT(get_mapgen_names);
API_FCT(get_modpath);
+ API_FCT(get_clientmodpath);
API_FCT(get_gamepath);
API_FCT(get_texturepath);
API_FCT(get_texturepath_share);
@@ -1162,4 +1173,3 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top)
API_FCT(get_modstore_list);
//API_FCT(gettext); (gettext lib isn't threadsafe)
}
-
diff --git a/src/script/lua_api/l_mainmenu.h b/src/script/lua_api/l_mainmenu.h
index d4946bab1..b5015add3 100644
--- a/src/script/lua_api/l_mainmenu.h
+++ b/src/script/lua_api/l_mainmenu.h
@@ -108,6 +108,8 @@ private:
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);