View Single Post
09-30-12, 08:15 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You should avoid using select(). Function calls are basically the slowest thing you can do, and are totally unnecessary here. Plus, you're actually using two calls to GetGuildRosterInfo() instead of just using variables properly.

Here is some code that will keep track of who is currently mobile in your guild:
Code:
local mobileStatus = {}

local eventFrame = CreateFrame("Frame")
eventFrame:RegisterEvent("GUILD_ROSTER_UPDATE")
eventFrame:SetScript("OnEvent", function()
	wipe(mobileStatus)
	
	local _, numOnline = GetNumGuildMembers()
	for i = 1, numOnline do
		local name, _, _, _, _, _, _, _, _, _, _, _, _, isMobile = GetGuildRosterInfo(i)
		mobileStatus[name] = isMobile
	end
end)
Then, when you want to find out if a specific player is mobile, just check their status in the table:
Code:
if mobileStatus[name] then
	print(name, "is using the Mobile Armory app.")
else
	print(name, "is logged into WoW.")
end
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote