mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 11:31:49 +00:00
add 'slotIndex' ui slot property
This commit is contained in:
parent
1ef174f204
commit
dfa9656871
4 changed files with 23 additions and 3 deletions
|
|
@ -215,6 +215,13 @@ static int p_get_inventory(UINode* node, lua::State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int p_get_slot_index(UINode* node, lua::State* L) {
|
||||
if (auto slot = dynamic_cast<SlotView*>(node)) {
|
||||
return lua::pushinteger(L, slot->getIndex());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int p_get_reset(UINode* node, lua::State* L) {
|
||||
if (dynamic_cast<Menu*>(node)) {
|
||||
return lua::pushcfunction(L, l_menu_reset);
|
||||
|
|
@ -663,6 +670,7 @@ static int l_gui_getattr(lua::State* L) {
|
|||
{"reset", p_get_reset},
|
||||
{"paste", p_get_paste},
|
||||
{"inventory", p_get_inventory},
|
||||
{"slotIndex", p_get_slot_index},
|
||||
{"focused", p_get_focused},
|
||||
{"cursor", p_get_cursor},
|
||||
{"data", p_get_data},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue