WoW:API GetNumWhoResults: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Revised for clarity and to match the current boilerplate. Moved comments to the talk page and added timestamps.)
Line 1: Line 1:
{{wowapi}}
{{wowapi}} __NOTOC__
<center>'''Title''' ''-Documentation by [[user:Mikk|Mikk]]-''</center>
 


Get the number of entries resulting from your most recent /who query.
Get the number of entries resulting from your most recent /who query.
  numWhos, totalCount = GetNumWhoResults();
== Arguments ==
:None


<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
  numWhos, totalCount = GetNumWhoResults();


== Parameters ==
== Returns ==
=== Returns ===
;''Returns''
:totalCount, numWhos
:totalCount, numWhos


Line 15: Line 16:
:;numWhos : Number - number of entries actually returned
:;numWhos : Number - number of entries actually returned


Normally, these two will be returned as the same number.
However, if the query matched more players than the server wants to return (currently 49), totalCount will be returned as 50 and numWhos will be returned as 49. Hence, totalCount being greater than numWhos seems to be a future-safe indication of the list having been truncated.
''FrameXML has these two names swapped around, but I suspect that it is a bug. There is code to display a warning about the list being truncated, but it never triggers.''
----
__NOTOC__
Comment by [[user:egingell|egingell]]
The following code does not produce the results I expected. First pass (assume that it should find 10 people) sends 'numWhos = 0 totalCount = 0' to the chat frame. Second pass (assume that it should find 1 person) sends 'numWhos = 10 totalCount = 10' to the chat frame. Third pass sends 'numWhos = 1 totalCount = 1' to the chat frame. GetNumWhoResults() seems to be one step behind [[API SendWho|SendWho]]().
SendWho(filter);
local numWhos, totalCount = GetNumWhoResults();
DEFAULT_CHAT_FRAME:AddMessage('numWhos = '..tostring(numWhos).. ' totalCount = '..tostring(totalCount));
----
__NOTOC__
Comment by [[user:hudlee|hudlee]]


After you call [[API SendWho|SendWho]]("filter"); you have to wait for a WHO_LIST_UPDATE [[Events %28API%29 | event]] before the results are available. So you'll need to call [[API GetNumWhoResults|GetNumWhoResults]](); from an [[Events %28API%29 | event]] handler.
== Details ==
: This function only returns the last /who query results after the "[[Events/W#WHO_LIST_UPDATE|WHO_LIST_UPDATE]]" event has fired.

Revision as of 17:34, 21 June 2007

WoW API < GetNumWhoResults


Get the number of entries resulting from your most recent /who query.

  numWhos, totalCount = GetNumWhoResults();


Arguments

None


Returns

totalCount, numWhos
totalCount
Number - number of users matching the query
numWhos
Number - number of entries actually returned


Details

This function only returns the last /who query results after the "WHO_LIST_UPDATE" event has fired.