Skip to content
Willexan edited this page Nov 9, 2018 · 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 3 values id, cloneId and state.

  • 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
  • state is a table that stores information about the current state. This is only used in 'Trigger State Updater'. Use the below for loop to find more information about the state.
    • for k,v in pairs(aura_env.state) do print(k,v) end

Within aura_env.state

The values contained within aura_env.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.