GetItemLinkReagentTraitInfo

From ESOUI Wiki

Jump to: navigation, search

Given an item link (for an alchemy reagent) and a trait index, this function returns two values representing the alchemy trait that exists in that index. The first value is a boolean indicating whether the trait is known to the player; the second value is a string containing the trait's name.

If the player doesn't know the trait, then the second return value will be nil. If the trait doesn't exist (i.e. the reagent only has four traits and you request information on the fifth trait), then both return values will be nil.

Contents

Arguments

itemLink
A string containing an item link, which should identify an alchemy reagent.
traitIndex
A number between 1 and GetMaxTraits(), inclusive.

Return values

isKnown
A boolean value indicating whether the player has discovered this trait on this reagent, or nil if you are requesting information on a trait that doesn't exist (i.e. an invalid traitIndex value).
traitName
A string containing the name of the trait, or nil if the player has not discovered the trait.

Example

--
-- If we have an itemLink for an alchemy reagent, how do we 
-- loop over all of its traits?
--
for i = 1, GetMaxTraits() do
   local known, name = GetItemLinkReagentTraitInfo(itemLink, i)
   if known then
      d(zo_strformat("Trait <<1>> is known; it's <<2>>.", i, name))
   end
end

External links

Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox