WowAce.com
Home
Addons
Authors
Forums
Knowledge base
Paste
Site issues
Sign in
LibPeriodicTable-3.1
Overview
Files
Tickets
Pages
Repository
Subscriptions
Curse
API
r3
Source
Markup:
*
= API = == :GetSetTable("setname") == <p>Returns a table with the contents of the requested set. </p> === Args === <dl><dt> "setname" <dd> string - The name of a set within PT3 </dl> === Returns === <p>table - </p> <ul><li><i>if this is a multiset:</i> a list ordered table of this multiset's member tables. </li><li><i>if this is not a multiset:</i> the index of each table member is the itemid, and the value of each member is the value of that itemid in the set (or true if the item has no attached value). Also contains the field .set, which is the set's name. </li></ul> === Remarks === <p>Use this function if you need to display a list of items in a set or something similar. </p> === Example === <pre>PT:GetSetTable("Reagent.Ammo") </pre> == :GetSetStringCompressed("setname") == <p>Returns the set data that PT3 has for a given set, without uncompressing it into a useable form. Will also autogenerate the correct strings for virtual children (which are implied in "c[]" sets) or virtual parents (which are implied in the data hierarchy). </p> === Args === <dl><dt> "setname" <dd> string - The name of a set within PT3 </dl> === Returns === <p>string - The <i>compressed</i> set string for this set. </p> === Remarks === <p>A quick and simple function for checking the state of a set. Good for keeping an eye on a dynamic custom set. </p> === Example === <pre>PT:GetSetStringCompressed("MyAddon.DataB") </pre> == :GetSetStringUncompressed("setname") == <p>Returns the set data that PT3 has for a given set, uncompressed into a usable form. Will also autogenerate the correct strings for virtual children (which are implied in "c[]" sets) or virtual parents (which are implied in the data hierarchy). </p> === Args === <dl><dt> "setname" <dd> string - The name of a set within PT3 </dl> === Returns === <p>string - The <i>uncompressed</i> set string for this set. </p> === Remarks === <p>A quick and simple function for checking the state of a set. Good for keeping an eye on a dynamic custom set. </p> === Example === <pre>PT:GetSetStringUncompressed("MyAddon.DataE") </pre> == :ItemInSet(item, "setname") == <p>Find if an item is contained within a set. </p> === Args === <dl><dt> item <dd> string or number - The itemid or itemlink of an item <dt> "setname" <dd> string - The name of a set within PT3 </dl> === Returns === <p>string - the value of this item within the given set. </p><p>string - the set that this item was found within. </p> === Example === <pre>PT:ItemInSet(24468, "Tradeskill.Crafted") </pre> == :AddData("name", arg2[, arg3]) == <p>Add custom data to PeriodicTable-3.0 </p> === Args === <dl><dt> "name" <dd> string - The name of the set or module you're importing <dt> arg2 <dd> string or table - The contents of the set's string -or- the table of the module -or- the module's version string <dt> arg3 <dd> table - The module's data contents (if you provided a version number) </dl> === Remarks === <p>Add data to PT3. Note that you can use this function to overwrite data that's already present, if, for example, a custom set gets changed. </p> === Example === <pre>PT:AddData("MyAddon.SetA", "u,11436:Moose,7521:Sock") PT:AddData("MyAddon", {["MyAddon.SetA"] = "u,11436:Moose,7521:Sock", ["MyAddon.SetB"] = "5132,25443",}) PT:AddData("MyAddon", "$Rev: 23470 $" ,{["MyAddon.SetA"] = "u,11436:Moose,7521:Sock", ["MyAddon.SetB"] = "5132,25443"}) </pre> == :ItemSearch(item) == <p>Search for an item in the PT3 data library. </p> === Args === <dl><dt> item <dd> string or number - itemid or itemlink </dl> === Returns === <p>table - a table of all the sets this item is a member of. </p> === Remarks === <p>This sucker is slow and heavy. It takes about 0.12 seconds for me at the moment. And it needs to uncompress -all- the set's data. The bad news is that this eats a ton of memory, the good news is that it can be reclaimed by the GC directly afterward. I'd suggest only using this when requested by the user, and then running collectgarbage() right afterward. If you must run this automatically, cache the results. </p> === Example === <pre>PT:ItemSearch(14373) </pre> == :GetNumSets() == <p>Returns the number of sets currently in the PT3 set library. Note that "c[]" style sets will take up more spots after being requested, so don't be alarmed if this number grows during operation. </p> === Returns === <p>number - the number of sets. </p> === Remarks === <p>Just kinda a 'toy' function for statistical purposes. </p> === Example === <pre>PT:GetNumSets() </pre> == :GetNumCachedSets() == <p>Returns the number of set tables currently in the PT3 cache. </p> === Returns === <p>number - the number of sets. </p> === Remarks === <p>Just kinda a 'toy' function for statistical purposes. </p> === Example === <pre>PT:GetNumCachedSets() </pre> == :GetBetter("setname",itema,itemb) == <p>Return which one of the items has the higher value. </p> === Args === <dl><dt> "setname" <dd> string - PT3 set name <dt> itema <dd> string or number - itemid or itemlink <dt> itemb <dd> string or number - itemid or itemlink </dl> === Returns === <p>number - the itemid of the higher valued item. </p> === Example === <pre>PT:GetBetter("Rep.Rewards",13221,32002) </pre> == :GetBest("setname") == <p>Get the highest valued item in this set. </p> === Args === <dl><dt> "setname" <dd> string - PT3 set name </dl> === Returns === <p>number - the itemid of the highest valued item </p><p>number - the value of the highest valued item </p> === Example === <pre>PT:GetBest("Rep.Rewards") </pre> == :IsSetMulti(set) == <p>Check to see if a set is a multiset. </p> === Args === <dl><dt> set <dd> string - name of a set </dl> === Returns === <p>boolean - true if set is a multiset, false if set is not, nil if set does not exist. </p> === Remarks === <p>Most handy for determining how to iterate a set table. See :GetSetTable() for more info </p> === Example === <pre>PT:IsSetMulti("InstanceLoot.Tempest Keep") </pre> == :IterateSet(set) == <p>Iterate all the items in a given set. </p> === Args === <dl><dt> set <dd> string - name of a set </dl> === Returns === <p>number - itemid of the item string or boolean - value of the item string - set origin of the item </p> === Example === <pre>for item, value, set in PT:IterateSet("Misc.Minipet") do self:Print(item,value,set) end </pre> <!-- restored from web page -->
Markup Type:
*
The type of markup for this entry.
Click here for details
.
WikiCreole
BBCode
Safe HTML
Plain Text
Markdown
Textile
Curse Wiki (Deprecated)