Skip to main content

Overview

Core WeakAuras functions provide the main API for managing auras, regions, and trigger systems.

Aura Management

GetData

Retrieves the data table for a specific aura.
id
string
required
The unique identifier of the aura
data
table
The aura data table containing all configuration
local data = WeakAuras.GetData("MyAuraID")
if data then
  print("Aura region type:", data.regionType)
end

GetRegion

Retrieves the display region for a specific aura.
id
string
required
The unique identifier of the aura
region
frame
The region frame object
local region = WeakAuras.GetRegion("MyAuraID")
if region then
  region:SetAlpha(0.5)
end

Add

Adds a new aura or updates an existing one.
data
table
required
The aura data table with all configuration
simpleChange
boolean
If true, treats this as a simple property change (optimization)
-- Add new aura
WeakAuras.Add({
  id = "MyAura",
  regionType = "icon",
  triggers = {
    {
      trigger = {
        type = "aura2",
        auranames = "Bloodlust"
      }
    }
  }
})
Always validate your data table structure before calling Add to avoid errors.

Delete

Deletes an aura.
data
table|string
required
The aura data table or aura ID string
-- Delete by ID
WeakAuras.Delete("MyAuraID")

-- Or delete by data table
local data = WeakAuras.GetData("MyAuraID")
WeakAuras.Delete(data)

Rename

Renames an aura to a new ID.
data
table
required
The aura data table
newid
string
required
The new unique identifier
local data = WeakAuras.GetData("OldID")
WeakAuras.Rename(data, "NewID")
Rename updates all internal references and parent-child relationships automatically.

InternalVersion

Returns the internal version number of WeakAuras.
version
number
The internal version number
local version = WeakAuras.InternalVersion()
print("WeakAuras internal version:", version)

Display Functions

OpenOptions

Opens the WeakAuras options window.
msg
string
Optional message or aura ID to focus
WeakAuras.OpenOptions()
-- Or open to specific aura
WeakAuras.OpenOptions("MyAuraID")

Toggle

Toggles the pause state of WeakAuras.
WeakAuras.Toggle() -- Pause or resume

IsPaused

Checks if WeakAuras is currently paused.
paused
boolean
True if paused, false otherwise
if WeakAuras.IsPaused() then
  print("WeakAuras is paused")
end

IsOptionsOpen

Checks if the options window is currently open.
open
boolean
True if options are open
if WeakAuras.IsOptionsOpen() then
  print("Options window is open")
end

Trigger State Management

GetTriggerStateForTrigger

Retrieves the trigger state for a specific trigger.
id
string
required
The aura identifier
triggernum
number
required
The trigger number (1-based index)
states
table
Table of trigger states keyed by clone ID
local states = WeakAuras.GetTriggerStateForTrigger("MyAura", 1)
for cloneId, state in pairs(states) do
  print("Clone:", cloneId, "Show:", state.show)
end

GetActiveConditions

Retrieves active conditions for an aura and clone.
id
string
required
The aura identifier
cloneId
string
required
The clone identifier
conditions
table
Table of active conditions
local conditions = WeakAuras.GetActiveConditions("MyAura", "")

Utility Functions

prettyPrint

Prints a formatted message with the WeakAuras prefix.
message
string
required
The message to print
WeakAuras.prettyPrint("This is a formatted message")

split

Splits a string by commas and whitespace.
input
string
required
The string to split
parts
table
Array of string parts
local parts = WeakAuras.split("one, two, three")
for i, part in ipairs(parts) do
  print(i, part)
end

UnitNameWithRealm

Gets the unit name with realm suffix.
unit
string
required
The unit identifier
name
string
The unit name
realm
string
The realm name
local name, realm = WeakAuras.UnitNameWithRealm("player")
print(name .. "-" .. realm)

Advanced Functions

ScanEvents

Manually triggers an event scan.
event
string
required
The event name
...
any
Event arguments
WeakAuras.ScanEvents("CUSTOM_EVENT", arg1, arg2)

LoadFunction

Loads and compiles a Lua function string.
code
string
required
The Lua code string
id
string
required
The aura ID for error reporting
func
function
The compiled function
local func = WeakAuras.LoadFunction("return function() print('Hello') end", "MyAura")
if func then
  func()()
end

Range and Combat Functions

CheckRange

Checks if a unit is within a specific range.
unit
string
required
The unit ID (e.g., “target”, “player”)
range
number
required
The range to check in yards
operator
string
required
The comparison operator: <= or >=
inRange
boolean
True if the unit meets the range condition
-- Check if target is within 30 yards
if WeakAuras.CheckRange("target", 30, "<=") then
  print("Target is close")
end

IsSpellInRange

Checks if a spell is in range of a unit.
spellId
number|string
required
The spell ID or name
unit
string
required
The unit ID
inRange
boolean
True if spell is in range
local inRange = WeakAuras.IsSpellInRange(5308, "target") -- Execute
if inRange then
  print("Execute is in range")
end

GetRange

Gets the estimated range to a unit.
unit
string
required
The unit ID
checkVisible
boolean
If true, only check visible units
minRange
number
Minimum range in yards
maxRange
number
Maximum range in yards
local minRange, maxRange = WeakAuras.GetRange("target", true)
print(string.format("Target is %d-%d yards away", minRange or 0, maxRange or 999))

State Functions

IsAuraActive

Checks if an aura is currently active (showing).
id
string
required
The aura identifier
active
boolean
True if aura is active
if WeakAuras.IsAuraActive("MyAura") then
  print("Aura is showing")
end

IsAuraLoaded

Checks if an aura is loaded (meets load conditions).
id
string
required
The aura identifier
loaded
boolean
True if aura is loaded
if WeakAuras.IsAuraLoaded("MyAura") then
  print("Aura is loaded and ready")
end

Registration Functions

RegisterSubRegionType

Registers a new sub-region type for custom extensions.
name
string
required
The sub-region type name
displayName
string
required
The display name shown in UI
supportFunction
function
required
Function that determines if this sub-region is supported for a region type
createFunction
function
required
Function to create the sub-region
modifyFunction
function
required
Function to update the sub-region
onAcquire
function
Called when sub-region is acquired from pool
onRelease
function
Called when sub-region is released to pool
default
table
required
Default configuration table
properties
table
required
Property definitions for configuration
-- Example: Register custom sub-region
WeakAuras.RegisterSubRegionType(
  "customSubRegion",
  "Custom Sub-Region",
  function(regionType) return true end, -- Support all types
  function(parent) -- Create
    local region = CreateFrame("Frame", nil, parent)
    return region
  end,
  function(parent, region, data) -- Modify
    region:SetSize(data.width or 100, data.height or 100)
  end,
  nil, -- onAcquire
  nil, -- onRelease
  { width = 100, height = 100 }, -- default
  {} -- properties
)
Only use registration functions if you’re developing WeakAuras extensions.

See Also

Build docs developers (and LLMs) love