diff options
author | rubenwardy <rw@rubenwardy.com> | 2022-01-30 22:40:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-30 22:40:53 +0000 |
commit | 128f6359e936bcdc5e26409ddd73438bce9c6dd6 (patch) | |
tree | f4d396d479ae17f57f25ab78df300256e28d5945 /src/script/lua_api | |
parent | 8c0331d2449cf71049c7ce9c06d141e2846ebcb0 (diff) | |
download | minetest-128f6359e936bcdc5e26409ddd73438bce9c6dd6.tar.gz minetest-128f6359e936bcdc5e26409ddd73438bce9c6dd6.tar.bz2 minetest-128f6359e936bcdc5e26409ddd73438bce9c6dd6.zip |
Use virtual paths to specify exact mod to enable (#11784)
Diffstat (limited to 'src/script/lua_api')
-rw-r--r-- | src/script/lua_api/l_mainmenu.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index 736ad022f..db031dde5 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -323,9 +323,9 @@ int ModApiMainMenu::l_get_games(lua_State *L) lua_newtable(L); int table2 = lua_gettop(L); int internal_index = 1; - for (const std::string &addon_mods_path : game.addon_mods_paths) { + for (const auto &addon_mods_path : game.addon_mods_paths) { lua_pushnumber(L, internal_index); - lua_pushstring(L, addon_mods_path.c_str()); + lua_pushstring(L, addon_mods_path.second.c_str()); lua_settable(L, table2); internal_index++; } @@ -533,14 +533,14 @@ 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); + lua_setfield(L, -2, "mods"); + for (const std::string &component : getEnvModPaths()) { - index++; lua_pushstring(L, component.c_str()); - lua_rawseti(L, -2, index); + lua_setfield(L, -2, fs::AbsolutePath(component).c_str()); } return 1; } |