Skip to content

Commit 4c49bce

Browse files
committed
feat(client): add getters getElementBy[Vaue/Index]
1 parent a16d4a9 commit 4c49bce

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

client/main.lua

+12-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ function MenuData.Open(type, namespace, name, data, submit, cancel, change, clos
3737

3838
menu.close = function()
3939
MenuData.RegisteredTypes[type].close(namespace, name)
40-
4140
for i = 1, #MenuData.Opened, 1 do
4241
if MenuData.Opened[i] then
4342
if MenuData.Opened[i].type == type and MenuData.Opened[i].namespace == namespace and MenuData.Opened[i].name == name then
@@ -118,6 +117,18 @@ function MenuData.Open(type, namespace, name, data, submit, cancel, change, clos
118117
menu.data.title = val
119118
end
120119

120+
menu.getElementByIndex = function(index)
121+
return menu.data.elements[index]
122+
end
123+
124+
menu.getElementByValue = function(value)
125+
for i = 1, #menu.data.elements, 1 do
126+
if menu.data.elements[i].value == value then
127+
return menu.data.elements[i]
128+
end
129+
end
130+
end
131+
121132
menu.removeElement = function(query)
122133
for i = 1, #menu.data.elements, 1 do
123134
for k, v in pairs(query) do

0 commit comments

Comments
 (0)