pack.get_installed + pack docs

This commit is contained in:
MihailRis
2024-03-23 23:55:02 +03:00
parent 15b11d52ad
commit 86a2349863
3 changed files with 51 additions and 0 deletions
+11
View File
@@ -25,7 +25,18 @@ static int l_pack_get_folder(lua_State* L) {
return 1;
}
static int l_pack_get_installed(lua_State* L) {
auto& packs = scripting::engine->getContentPacks();
lua_createtable(L, packs.size(), 0);
for (size_t i = 0; i < packs.size(); i++) {
lua_pushstring(L, packs[i].id.c_str());
lua_rawseti(L, -2, i + 1);
}
return 1;
}
const luaL_Reg packlib [] = {
{"get_folder", lua_wrap_errors<l_pack_get_folder>},
{"get_installed", lua_wrap_errors<l_pack_get_installed>},
{NULL, NULL}
};