Returns information about an action slot


See also Action functions.

Signature:

type, id, subType, spellID = GetActionInfo(slot)

Arguments:

  • slot - An action slot (number)

Returns:

  • type - Type of action in the slot (string)

    • companion - Summons a mount or non-combat pet
    • equipmentset - Equips a set of items
    • flyout - Brings up a menu of related spells
    • item - Uses an item
    • macro - Runs a macro
    • spell - Casts a spell

  • id - An identifier for the action; varies by type: (number or string)

    • companion - The companion's index in the mount or minipet list
    • equipmentset - Name of the equipment set
    • item - The item's itemID
    • macro - The macro's index in the macro list (macroID)
    • spell - The spell's index in the player's spellboook ( spellbookID)

  • subType - Subtype of the action (or nil if not applicable) (string)

    • CRITTER - For companion actions: indicates id is as an index in the non-combat pets list
    • MOUNT - For companion actions: indicates id is an index in the mounts list
    • spell - For spell actions: indicates id is an index in the player's spellbook (as opposed to the pet's)

  • spellID - For spell and companion actions, the global ID of the spell (or the summoning "spell" for a companion) (string, spellID)

Examples:

-- Prints all types and subtypes found in the player's actions
local types = {}
for i=1,120 do
   local type,id,subtype = GetActionInfo(i)
   if type then
      types[type] = types[type] or {}
      if subtype then
         types[type][subtype] = 1
      end
   end
end

for type, subtypes in pairs(types) do
   print("Type:", type, "subtypes:")
   local numSubtypes = 0
   for subtype in pairs(subtypes) do
      print("   ", subtype)
      numSubtypes = numSubtypes + 1
   end

   if numSubtypes == 0 then
      print("   no subtypes")
   end
end