API GetFriendInfo

Retrieves information about a person on your friends list. name, level, class, area, connected, status, note = GetFriendInfo(friendIndex);

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 - 1 if friend is online, nil otherwise.
 * note : String - Friends note.
 * status : String - Friend's current status flags (AFK or DND).

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  friend Bill (The level 99 Leprechaun) is in Neverland.