WoW API < GetFriendInfo

Retrieves information about a person on your friends list.

name, level, class, area, connected, status, note = GetFriendInfo(friendIndex);

Parameters Edit

Arguments Edit

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 Edit

String - Friend's name, or nil (if index is invalid)
Integer - Friend's level, or 0 (if offline/invalid).
String - Friend's class, or "Unknown" (if offline/invalid).
String - Friend's current location, or "Unknown" (if offline/invalid).
Boolean - 1 if friend is online, nil otherwise.
String - Friends note.
String - Friend's current status flags (AFK or DND).

Example Edit

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 "" (The level "..level.." "..class..") is in "..loc..".");
 DEFAULT_CHAT_FRAME:AddMessage("You have no friends?!");


Your <AFK> friend Bill (The level 99 Leprechaun) is in Neverland.


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.

References Edit

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.