Skip to content
nullKomplex edited this page Sep 30, 2019 · 12 revisions

aura_env

aura_env is a built-in local table at the top of each aura declaration. Variables declared in this table will have their scope limited to the containing aura. aura_env can be accessed as global variables by functions within the current aura while remaining invisible to other auras.

To use aura_env for your own variables, simply assign it as a prefix to your variable name. An example of its use would be:

--Custom Trigger Function
function()
    -- Select the icon for either Moonkin form or Bear form.   
    aura_env.icon = select(2, WA_GetUnitBuff("player", "Moonkin Form")) or select(2, WA_GetUnitBuff("player", "Bear form"))
    return aura_env.icon -- If an icon is present, this will return true.
end

-- Custom Icon Function
function()
    -- Return the Icon we found. (Moonkin, Bear, or None)
    return aura_env.icon
end

If you are still confused on how aura_env is initialized here is a quick example of what it may look like

-- Combined Display function
function()
  -- Localized variables that are available across all Display functions
  local aura_env = {
    id = AURA_NAME
  } -- example

  local trigger_function = function()
    -- Trigger code
  end

  local untrigger_function = function()
    -- Untrigger code
  end
end

Within aura_env

aura_env currently has 5 values id, cloneId, region, state and states.

  • id simply outputs the name of the current aura.
  • cloneId is used with "Trigger State Updater" where it will return unique ID for each state.
  • region is the region of the aura. See here for more.
  • state is a table that stores information about the current state. Use the below for loop to find more information about the state. The current state is the one that the aura is pulling dynamic information from.
    • for k,v in pairs(aura_env.state) do print(k,v) end
  • states is a table that stores the state information of every trigger, similar to state
    • aura_env.states[2] would access the state of the second trigger.

Within aura_env.state and aura_env.states

The values contained within the state depend on the type of aura being used (icon, progress bar, texture, etc.) Some potentially useful ones are:

  • aura_env.state.stacks
  • aura_env.state.duration
  • aura_env.state.expirationTime
  • aura_env.state.icon
  • aura_env.state.spellId

Be especially careful to catch nil values from these variables before using them in things like custom animation functions.