lua: added hud.open_permanent(layoutid)

This commit is contained in:
MihailRis
2024-02-17 02:57:42 +03:00
parent 4e126e25cf
commit e58624d3e8
4 changed files with 52 additions and 4 deletions
+11
View File
@@ -63,3 +63,14 @@ int l_hud_open_block(lua_State* L) {
lua_pushstring(L, def->uiLayout.c_str());
return 2;
}
int l_hud_open_permanent(lua_State* L) {
auto assets = scripting::engine->getAssets();
auto name = lua_tostring(L, 1);
auto layout = assets->getLayout(name);
if (layout == nullptr) {
luaL_error(L, "layout '%s' is not found", name);
}
scripting::hud->openPermanent(layout);
return 0;
}