Quantcast

Adding missing API *cough*

Adrian L Lange [07-02-11 - 21:14]
Adding missing API *cough*
Filename
Monomyth.lua
diff --git a/Monomyth.lua b/Monomyth.lua
index 9c7cf8d..1f05588 100644
--- a/Monomyth.lua
+++ b/Monomyth.lua
@@ -33,11 +33,16 @@ Monomyth:Register('QUEST_GREETING', function()
 	end
 end)

+-- This should be part of the API, really
+local function IsQuestCompleted(index)
+	return not not select(index * 4, GetGossipActiveQuests())
+end
+
 Monomyth:Register('GOSSIP_SHOW', function()
 	local active = GetNumGossipActiveQuests()
 	if(active > 0) then
-		for index = 1, select('#', GetGossipActiveQuests()), 4 do
-			if(select(index + 3, GetGossipActiveQuests())) then
+		for index = 1, active do
+			if(IsQuestCompleted(index)) then
 				SelectGossipActiveQuest(index)
 			end
 		end