check if button exists first

This commit is contained in:
WantedDV 2023-04-23 00:25:30 -02:30
parent 6fecdeb68d
commit cc11aa25b7

View File

@ -17,6 +17,9 @@ local SetButtonState = function(button, state)
end
local RemoveButton = function(buttonTable, button)
if not button then
return
end
for id, v in pairs(buttonTable) do
if buttonTable[id].optionDisplay == button.stringRef then
table.remove(buttonTable, id)
@ -31,6 +34,9 @@ local RemoveSpaces = function(buttonTable)
end
local GetButtonIndex = function(buttonTable, button)
if not button then
return nil
end
for id, v in pairs(buttonTable) do
if buttonTable[id].optionDisplay == button.stringRef then
return id