mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
lua: added hud.open_permanent(layoutid)
This commit is contained in:
parent
4e126e25cf
commit
e58624d3e8
4 changed files with 52 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,13 @@
|
|||
extern int l_hud_open_inventory(lua_State* L);
|
||||
extern int l_hud_close_inventory(lua_State* L);
|
||||
extern int l_hud_open_block(lua_State* L);
|
||||
extern int l_hud_open_permanent(lua_State* L);
|
||||
|
||||
static const luaL_Reg hudlib [] = {
|
||||
{"open_inventory", l_hud_open_inventory},
|
||||
{"close_inventory", l_hud_close_inventory},
|
||||
{"open_block", l_hud_open_block},
|
||||
{"open_permanent", l_hud_open_permanent},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue