mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-14 00:55:20 +02:00
Add "MINETEST_MOD_PATH" environment variable (#11515)
This adds an environment variable MINETEST_MOD_PATH. When it exists, Minetest will look there for mods in addition to ~/.minetest/mods/.
This commit is contained in:
@@ -502,6 +502,21 @@ int ModApiMainMenu::l_get_modpath(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
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)
|
||||
{
|
||||
@@ -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);
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user