View Single Post
11-13-13, 11:28 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You have a scoping problem.

Code:
for k, v in pairs(flasks) do
	local flask =  UnitBuff("player", k)
	-- "flask" is local to this scope.
end

-- "flask" does not exist in this scope.
if (not isGuildGroup and food) or (isGuildGroup and flask and food) then
	ReadyCheckFrame:Hide()
	ConfirmReadyCheck(1)
end
Also, you may want to change your GetSpellName function to return an empty string, or UNKNOWN, or some other "dummy" value for spell IDs that don't return a real name. Otherwise, if Blizzard changes a spell ID, you will end up with holes in your otherwise sequentially-indexed table.

Also also, since you are using an indexed table, you should use for i = 1, #flasks do local k = flasks[ i ] instead of for k, v in pairs(flasks) to avoid the slow call to pairs.
__________________
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.

Last edited by Phanx : 11-13-13 at 11:32 PM.
  Reply With Quote