m (Added two new arguments. isReferAFriend and guid.) |
|||
Line 1: | Line 1: | ||
{{wowapi}} __NOTOC__ |
{{wowapi}} __NOTOC__ |
||
Retrieves information about a person on your friends list. |
Retrieves information about a person on your friends list. |
||
− | name, level, class, area, connected, status, note = GetFriendInfo(friendIndex); |
+ | name, level, class, area, connected, status, note, isReferAFriend, guid = GetFriendInfo(friendIndex); |
== Parameters == |
== Parameters == |
||
Line 12: | Line 12: | ||
:;class : String - Friend's class, or "Unknown" (if offline/invalid). |
:;class : String - Friend's class, or "Unknown" (if offline/invalid). |
||
:;area : String - Friend's current location, or "Unknown" (if offline/invalid). |
:;area : String - Friend's current location, or "Unknown" (if offline/invalid). |
||
− | :;connected : Boolean - |
+ | :;connected : Boolean - true if friend is online, false otherwise. |
:;status : String - Friend's current status flags (AFK or DND). |
:;status : String - Friend's current status flags (AFK or DND). |
||
− | :;note : String - Friends note |
+ | :;note : String - Friends note, or nil |
+ | :;isReferAFriend : Boolean - true is Refer-A-Friend |
||
+ | :;guid : String - a string containing the hexadecimal representation of the player's [[GUID]]. Player-[server ID]-[player UID] (Example: "Player-976-0002FD64") |
||
== Example == |
== Example == |
Revision as of 09:13, 1 December 2018
Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
Retrieves information about a person on your friends list.
name, level, class, area, connected, status, note, isReferAFriend, guid = GetFriendInfo(friendIndex);
Parameters
Arguments
- friendIndex
- Integer - Index of friend in the friend list (Note that status changes can re-order the friend list, indexes are not guaranteed to remain stable across events) (Also note that index should not be greater than 50 [see Notes]).
Returns
- name
- String - Friend's name, or nil (if index is invalid)
- level
- Integer - Friend's level, or 0 (if offline/invalid).
- class
- String - Friend's class, or "Unknown" (if offline/invalid).
- area
- String - Friend's current location, or "Unknown" (if offline/invalid).
- connected
- Boolean - true if friend is online, false otherwise.
- status
- String - Friend's current status flags (AFK or DND).
- note
- String - Friends note, or nil
- isReferAFriend
- Boolean - true is Refer-A-Friend
- guid
- String - a string containing the hexadecimal representation of the player's GUID. Player-[server ID]-[player UID] (Example: "Player-976-0002FD64")
Example
This example is pre-2.4 and thus doesn't utilize the friend note.
local name, level, class, loc, connected, status = GetFriendInfo(1); if (name) then DEFAULT_CHAT_FRAME:AddMessage("Your "..status.." friend "..name.." (The level "..level.." "..class..") is in "..loc.."."); else DEFAULT_CHAT_FRAME:AddMessage("You have no friends?!"); end
Result
Your <AFK> friend Bill (The level 99 Leprechaun) is in Neverland.
Notes
Friend information isn't necessarily automatically kept up to date. You can use the ShowFriends function to request an update from the server.
Do not use indexes greater than 50 (the maximum number of friend list entries)!
With some AddOns installed the client may crash after typing "/script GetFriendInfo(51)" (especially if FlagRSP is activated).
This crash leads to ERROR #132 (memory could not be "read").
Please use GetNumFriends() to iterate over all indexes securely.