WoW:API GetTradePlayerItemLink: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Move page script moved page API GetTradePlayerItemLink to API GetTradePlayerItemLink without leaving a redirect) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{wowapi}} | |||
<!-- Describe the purpose of the function, exhausting detail can be saved for a later section --> | <!-- Describe the purpose of the function, exhausting detail can be saved for a later section --> | ||
Line 12: | Line 12: | ||
:(ID) | :(ID) | ||
:;ID : numeric - index value of the "player's" (your character) trade slots (starts at | :;ID : numeric - index value of the "player's" (your character) trade slots (starts at 1 and proceeds to 6. 7 may be used for the will-not-be-traded-slot.) | ||
=== Returns === | === Returns === | ||
Line 23: | Line 23: | ||
== Example == | == Example == | ||
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory --> | <!-- If it helps, include an example here, though it's not required if the usage is self-explanatory --> | ||
for i = | for i = 1, 7 do | ||
chatItemLink = GetTradePlayerItemLink(i); | chatItemLink = GetTradePlayerItemLink(i); | ||
end | end | ||
Line 53: | Line 53: | ||
---- | ---- | ||
__NOTOC__ | __NOTOC__ | ||
Latest revision as of 04:46, 15 August 2023
← WoW API < GetTradePlayerItemLink
Returns a single value: chat-ready item link.
chatItemLink = GetTradePlayerItemLink(ID);
Parameters[edit]
Arguments[edit]
- (ID)
- ID
- numeric - index value of the "player's" (your character) trade slots (starts at 1 and proceeds to 6. 7 may be used for the will-not-be-traded-slot.)
Returns[edit]
- Returns
- chatItemLink
- chatItemLink
- String - a string that can be used to link items in the chat log
Example[edit]
for i = 1, 7 do chatItemLink = GetTradePlayerItemLink(i); end
Details[edit]
- Remember, chatItemLink(s) are different than itemLink parameters needed by many APIs. To properly extract an itemLink from a chatItemLink, here is a neat function:
--[[ Function: extractItemLinkFromChatItemLink Purpose: gets an item link string from a chat item link string Note: don't ask questions, it works ]] function extractItemLinkFromChatItemLink(message) local _, _, _, _itemLink = string.find(message, "(|H(.+)|h)"); _, _, _itemLink = string.find(_itemLink, "(.-|h)"); return _itemLink; end
- Here is a chatItemLink Example:
|cffffffff|Hitem:3771:0:0:0|h[Wild Hog Shank]|h|r
- Here is an itemLink Example:
item:3771:0:0:0