1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add check_mod_configuration to main menu

This commit is contained in:
rubenwardy 2022-05-07 16:45:17 +01:00
parent 06de82fd86
commit 9f41b4f72d
11 changed files with 277 additions and 13 deletions

View file

@ -2143,3 +2143,35 @@ void push_collision_move_result(lua_State *L, const collisionMoveResult &res)
lua_setfield(L, -2, "collisions");
/**/
}
void push_mod_spec(lua_State *L, const ModSpec &spec, bool include_unsatisfied)
{
lua_newtable(L);
lua_pushstring(L, spec.name.c_str());
lua_setfield(L, -2, "name");
lua_pushstring(L, spec.author.c_str());
lua_setfield(L, -2, "author");
lua_pushinteger(L, spec.release);
lua_setfield(L, -2, "release");
lua_pushstring(L, spec.desc.c_str());
lua_setfield(L, -2, "description");
lua_pushstring(L, spec.path.c_str());
lua_setfield(L, -2, "path");
lua_pushstring(L, spec.virtual_path.c_str());
lua_setfield(L, -2, "virtual_path");
lua_newtable(L);
int i = 1;
for (const auto &dep : spec.unsatisfied_depends) {
lua_pushstring(L, dep.c_str());
lua_rawseti(L, -2, i++);
}
lua_setfield(L, -2, "unsatisfied_depends");
}

View file

@ -42,6 +42,7 @@ extern "C" {
// We do a explicit path include because by default c_content.h include src/client/hud.h
// prior to the src/hud.h, which is not good on server only build
#include "../../hud.h"
#include "content/mods.h"
namespace Json { class Value; }
@ -204,3 +205,5 @@ void push_hud_element (lua_State *L, HudElement *elem);
bool read_hud_change (lua_State *L, HudElementStat &stat, HudElement *elem, void **value);
void push_collision_move_result(lua_State *L, const collisionMoveResult &res);
void push_mod_spec(lua_State *L, const ModSpec &spec, bool include_unsatisfied);