@@ -839,7 +839,6 @@ local function navigateMenu(wheelDirection, menus, selected)
839839 local validOptionCount = # validOptions
840840 -- no valid options (if this happens something is wrong!)
841841 if validOptionCount == 0 then return 1 , 0 end
842-
843842 -- find the `current selected index` and its `position`
844843 local currentIndex = nil
845844 for i , option in ipairs (validOptions ) do
@@ -871,13 +870,10 @@ local function updateSelectedItem(menus, selected, nextSelectedIndex)
871870end
872871
873872function Container .changeMenuItem (scaleform , menuData , wheelDirection )
874- if not hasValidMenuOption (menuData ) then
875- return
876- end
873+ if not hasValidMenuOption (menuData ) then return end
877874
878875 local selected = menuData .selected
879876 local menus = menuData .menus
880-
881877 -- Ignore if list is empty, selected is not present, or menus are absent
882878 if not selected or not menus or not next (menus ) then
883879 return
@@ -1247,6 +1243,24 @@ function Container.syncData(scaleform, menuData, refreshUI)
12471243 end
12481244end
12491245
1246+ function IsMenuVisible (menu_data )
1247+ local is_visible = false
1248+ for _ , menu in pairs (menu_data .menus ) do
1249+ local menu_id = menu .id
1250+ local original_menu_data = Container .get (menu_id )
1251+
1252+ if original_menu_data and not original_menu_data .flags .deleted then
1253+ for _ , option in ipairs (menu .options ) do
1254+ if option .flags .hide == false then
1255+ is_visible = true
1256+ end
1257+ end
1258+ end
1259+ end
1260+
1261+ return is_visible
1262+ end
1263+
12501264-- Validate and synchronize the selected option. If it's the first encounter with the menu,
12511265-- choose a valid option; otherwise, restore the state on top of revalidating it
12521266--- @param scaleform table
0 commit comments