WoW:API GetPartyMember: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
m (Move page script moved page API GetPartyMember to API GetPartyMember without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<center>'''GetPartyMember'''</center>
{{wowapi}} __NOTOC__
Returns 1 if the specified party member exists, nil otherwise.
memberExists = GetPartyMember(index);


memberUnitId = GetPartyMember(index);
==Parameters==
===Arguments===
:;index : Number - Which party member to query (1-4).
===Returns===
:;memberExists: Flag - If the specified party member exists, returns 1, otherwise <tt>nil</tt>.


Returns the [[API TYPE UnitId|unit Id]] of the specified party member if that party member exists, or <tt>nil</tt> otherwise.
==Example==
 
memberCount = 0
----
for groupindex = 1,MAX_PARTY_MEMBERS do
;''Arguments''
  if (GetPartyMember(groupindex)) then
 
  memberCount = memberCount + 1
:(index)
:;index : Number - Which party member to query (1-4)
 
----
;''Returns''
 
:memberUnitId
:;memberUnitId : Number - If the specified party member exists, returns the id of that member, otherwise returns <tt>nil</tt>
 
The numbers always translate directly; querying for 1 will return "party1", 2 "party2", etc, as long as that party slot is filled. This is mostly useful for testing for whether the party member in question exists. Though a more straightforward method of accomplishing that is, of course, simply calling [[API GetNumPartyMembers|GetNumPartyMembers()]].
 
----
;''Example''
 
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
 
  memberCount = 0
  for groupindex = 1,MAX_PARTY_MEMBERS do
    if (GetPartyMember(groupindex)) then
      memberCount = memberCount + 1
    end
   end
   end
end


;''Result''
===Result===
 
Will count the number of members in the party (not the best way to do that but it's a reasonable example).
:Will count the number of members in the party (not the best way to do that but it's a reasonable example).
 
----
{{Template:WoW API}}

Latest revision as of 04:46, 15 August 2023

WoW API < GetPartyMember

Returns 1 if the specified party member exists, nil otherwise.

memberExists = GetPartyMember(index);

Parameters[edit]

Arguments[edit]

index
Number - Which party member to query (1-4).

Returns[edit]

memberExists
Flag - If the specified party member exists, returns 1, otherwise nil.

Example[edit]

memberCount = 0
for groupindex = 1,MAX_PARTY_MEMBERS do
 if (GetPartyMember(groupindex)) then
  memberCount = memberCount + 1
 end
end

Result[edit]

Will count the number of members in the party (not the best way to do that but it's a reasonable example).