WoW:API GetFriendInfo: Difference between revisions

m
Updated index description, added details.
mNo edit summary
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 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)
== Parameters ==
== Parameters ==
=== Arguments ===
=== Arguments ===
:(friendIndex)
:(friendIndex)


:;friendIndex : Integer - Index of friend (Does not appear to be the exact order they appear in the friends list as online friends are sorted to the top but always have the same index)
:;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


 
:;name : String - Friend's name ("Unknown" if index is out of bounds.)
:;name : String - Friends name.
:;level : Integer - Friend's level (0 if player is not online, 1 if index is out of bounds (confirmed by [[User:Topaz|Topaz]] 22:37, 12 Mar 2005 (EST))
:;level : Integer - Friends level. If unknown returns 0, but sometimes 1 (can someone else test this)
:;class : String - Friend's class ("Unknown" if index is out of bounds or friend is offline).
::looks like this is 1 when arg1 is out of bounds (e.g., 0) --[[User:Topaz|Topaz]] 22:37, 12 Mar 2005 (EST)
:;area : String - Friend's current location ("Unknown" if index is out of bounds or friend is offline).
:;class : String - Friends class. If unknown returns "Unknown"
:;connected : Flag - 1 if friend is online, nil if not online (or index out of bounds).
:;area : String - Friends current location. If unknown returns "Unknown"
:;connected : Boolean - Whether or not the friend is currently online
 
== Example ==
== Example ==
<!-- begin code -->
local name, level, class, loc = GetFriendInfo(1);
DEFAULT_CHAT_FRAME:AddMessage("Your friend "..name.." (The level "..level.." "..class..") is in "..loc..".");
<!-- end code -->
==== Result ====
<!-- begin code -->
Your friend Bill (The level 99 Leprechaun) is in Neverland.
<!-- end code -->


local num1, num2, num3, num4 = GetFriendInfo(1);
== Details ==
DEFAULT_CHAT_FRAME:AddMessage("Your friend "..num1.." (The level "..num2.." "..num3..") is in "..num4..".");
: 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.
 
====Result====
Your friend Bill (The level 99 Leprechaun) is in Neverland.


----
----
__NOTOC__
__NOTOC__
{{Template:WoW API}}
{{Template:WoW API}}
[[Category:API Functions|GetFriendInfo]]
[[Category:API Friend Functions|GetFriendInfo]]
[[Category:API Friend Functions|GetFriendInfo]]
Anonymous user