GE Lua Documentation

Press F to search!

updateActiveItem

Definition


-- @/lua/ge/extensions/ui/topBar.lua:186

local updateActiveItem = function()
  -- check if any of the key matches the state
  M.state.activeItem = nil

  -- check if any substate matches the state
  for _, item in pairs(Config.TopBarEntries) do
    if item.targetState == M.state.currentUIState then
      M.state.activeItem = item.id
      break
    elseif item.substates and #item.substates > 0 then
      for _, substate in pairs(item.substates) do
        if string.sub(M.state.currentUIState, 1, #substate) == substate then
          M.state.activeItem = item.id
          break
        end
      end
    end
  end

  guihooks.trigger(MODULE_NAME .. "_activeItemChanged", M.state.activeItem)
end

Callers

@/lua/ge/extensions/ui/topBar.lua
  -- M.updateVisibleItems()
  -- M.updateActiveItem()
end