WoW:API GetNumWhoResults: Difference between revisions
m (Remove singatures made using ~ in main namespace) |
No edit summary |
||
Line 25: | Line 25: | ||
---- | ---- | ||
__NOTOC__ | __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)); |
Revision as of 20:08, 6 March 2007
Get the number of entries resulting from your most recent /who query.
numWhos, totalCount = GetNumWhoResults();
Parameters
Returns
- Returns
- totalCount, numWhos
- totalCount
- Number - number of users matching the query
- 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.
Comment by 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 SendWho().
SendWho(filter); local numWhos, totalCount = GetNumWhoResults(); DEFAULT_CHAT_FRAME:AddMessage('numWhos = '..tostring(numWhos).. ' totalCount = '..tostring(totalCount));