1. Trying to figure out how to use the existing talent functions to get the name of the player's active talent tree - such as Assassination, Feral, Demonology, etc.

    This is what I tried:

    _, spec = GetTalentTabInfo(GetActiveTalentGroup(false, false));

    I know this is wrong, though, because GetActiveTalentGroup simply returns 1 for primary and 2 for secondary, regardless of what tree that actually is. So, for example, if a rogue were currently using his secondary spec, the above line of code would report Combat regardless of what it actually is.

    Does anyone know how to do this correctly? All I want is to get a string representing the name of the player's currently-active talent tree.

  2. GetTalentTabInfo takes 4 arguments: the tab index of the talent tree (1-3), whether it's the unit you're inspecting, whether it's a pet, and finally which spec (primary or secondary).

    So what you need to do is first get which group of talents is active with GetActiveTalentGroup.

    Then you need to get the tab number of the primary talent tree using GetPrimaryTalentTree.

    Lastly you can feed those results into GetTalentTabInfo which will give you all of the information about their primary spec.

     local inspect, pet = false, false
     local talentGroup = GetActiveTalentGroup(inspect, pet)
     local tabIndex = GetPrimaryTalentTree(inspect, pet, talentGroup)
     local _, name = GetTalentTabInfo(tabIndex, inspect, pet, talentGroup)
     print(name)
    

    Returns

    Feral Combat

    As a side note, most of the arguments to these functions are optional for what you're after, so this could be reduced to:

    local _, name = GetTalentTabInfo(GetPrimaryTalentTree())