Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
m (Minor clarifications and reformatting)
m (Updated index description, added details.)
Line 1: Line 1:
 
<center>'''GetFriendInfo''' - ''Documentation by [[user:Author|IonDefender]]''</center>
 
<center>'''GetFriendInfo''' - ''Documentation by [[user:Author|IonDefender]]''</center>
   
Gets the name, level, class, and location of one of your friends
+
Gets the name, level, class, location and status of a friend
   
 
name, level, class, area, connected = GetFriendInfo(friendIndex)
 
name, level, class, area, connected = GetFriendInfo(friendIndex)
Line 8: Line 8:
 
:(friendIndex)
 
:(friendIndex)
   
:;friendIndex : Integer - Index of friend (Note that UI friends list is displayed re-ordered to put online friends first)
+
:;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)
 
=== Returns ===
 
=== Returns ===
 
:name, level, class, area, connected
 
:name, level, class, area, connected
Line 26: Line 26:
 
Your friend Bill (The level 99 Leprechaun) is in Neverland.
 
Your friend Bill (The level 99 Leprechaun) is in Neverland.
 
<!-- end code -->
 
<!-- end code -->
  +
  +
== Details ==
  +
: Friend information isn't necessarily automatically kept up to date. You can use the [[API ShowFriends|ShowFriends]] function to request an update from the server.
  +
 
----
 
----
 
__NOTOC__
 
__NOTOC__

Revision as of 19:14, 11 September 2005

GetFriendInfo - Documentation by IonDefender

Gets the name, level, class, location and status of a friend

name, level, class, area, connected = GetFriendInfo(friendIndex)

Parameters

Arguments

(friendIndex)
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)

Returns

name, level, class, area, connected
name
String - Friend's name ("Unknown" if index is out of bounds.)
level
Integer - Friend's level (0 if player is not online, 1 if index is out of bounds (confirmed by Topaz 22:37, 12 Mar 2005 (EST))
class
String - Friend's class ("Unknown" if index is out of bounds or friend is offline).
area
String - Friend's current location ("Unknown" if index is out of bounds or friend is offline).
connected
Flag - 1 if friend is online, nil if not online (or index out of bounds).

Example

local name, level, class, loc = GetFriendInfo(1);
DEFAULT_CHAT_FRAME:AddMessage("Your friend "..name.." (The level "..level.." "..class..") is in "..loc..".");

Result

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

Details

Friend information isn't necessarily automatically kept up to date. You can use the ShowFriends function to request an update from the server.

Template:WoW API