local db = {
contextMenus = {
{
name = 'context1',
colour = 'black'
},
{
name = 'context2',
colour = 'green'
},
{
name = 'context3',
colour = 'black'
},
},
dialogMenus = {
{
name = 'dialog1',
colour = 'black'
},
{
name = 'dialog2',
colour = 'green'
},
}
}
RegisterCommand('allBlackMenus', function()
print('All Black Menus:')
HRLib.table.focusedHash(db, { colour = 'black' }, function(key, value, arrayInfo)
print('Menu Type:', key, '|', arrayInfo.curr.name)
end)
end)
--[[ Output:
All Black Menus:
Menu Type: contextMenus | context1
Menu Type: contextMenus | context3
Menu Type: dialogMenus | dialog1
]]
-- Or
local db = {
contextMenus = {
'test'
},
dialogMenus = {
'test'
},
otherMenus = {
'test2'
}
}
RegisterCommand('allBlackMenus', function()
print('All .... Menus:')
HRLib.table.focusedHash(db, 'test', function(key, value, arrayInfo)
print('Menu Type:', key, '|', arrayInfo.curr)
end)
end)
--[[ Output:
All .... Menus:
Menu Type: contextMenus | test
Menu Type: dialogMenus | test
]]