aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/script')
-rw-r--r--src/script/lua_api/l_mainmenu.cpp17
-rw-r--r--src/script/lua_api/l_mainmenu.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp
index 6e9a5c34f..57fddc0be 100644
--- a/src/script/lua_api/l_mainmenu.cpp
+++ b/src/script/lua_api/l_mainmenu.cpp
@@ -503,6 +503,21 @@ int ModApiMainMenu::l_get_modpath(lua_State *L)
}
/******************************************************************************/
+int ModApiMainMenu::l_get_modpaths(lua_State *L)
+{
+ int index = 1;
+ lua_newtable(L);
+ ModApiMainMenu::l_get_modpath(L);
+ lua_rawseti(L, -2, index);
+ for (const std::string &component : getEnvModPaths()) {
+ index++;
+ lua_pushstring(L, component.c_str());
+ lua_rawseti(L, -2, index);
+ }
+ return 1;
+}
+
+/******************************************************************************/
int ModApiMainMenu::l_get_clientmodpath(lua_State *L)
{
std::string modpath = fs::RemoveRelativePathComponents(
@@ -856,6 +871,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
API_FCT(get_mapgen_names);
API_FCT(get_user_path);
API_FCT(get_modpath);
+ API_FCT(get_modpaths);
API_FCT(get_clientmodpath);
API_FCT(get_gamepath);
API_FCT(get_texturepath);
@@ -889,6 +905,7 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top)
API_FCT(get_mapgen_names);
API_FCT(get_user_path);
API_FCT(get_modpath);
+ API_FCT(get_modpaths);
API_FCT(get_clientmodpath);
API_FCT(get_gamepath);
API_FCT(get_texturepath);
diff --git a/src/script/lua_api/l_mainmenu.h b/src/script/lua_api/l_mainmenu.h
index ec2d20da2..781185425 100644
--- a/src/script/lua_api/l_mainmenu.h
+++ b/src/script/lua_api/l_mainmenu.h
@@ -112,6 +112,8 @@ private:
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);