changeset 32:fc13da07d8e4 Prospect Me 2

Cleaned up some code, added comments, refined ProspectMe:AddEntry()
author Vynn <mischivin@gmail.com>
date Tue, 08 Nov 2016 02:36:30 -0500
parents c11461d5095c
children 31cf11210635
files ProspectMe.lua
diffstat 1 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ProspectMe.lua	Tue Nov 08 02:32:41 2016 -0500
+++ b/ProspectMe.lua	Tue Nov 08 02:36:30 2016 -0500
@@ -1,4 +1,6 @@
---Check for Saved Variables, if they don't exist, set defaults.
+--[[
+Check for Saved Variables, if they don't exist, set defaults.
+]]
 if not ProspectMe then
 	ProspectMe = {
 		Config = {
@@ -17,14 +19,23 @@
 	}
 end
 
-function ProspectMe:Debug(object) {
-	Dump(self)
-	if object then
-		Dump(object)
+--[[
+Creates an table entry, if it does not exist, and adds results to the entry.
+Expects the Item ID and pairs of arguments in table with key being the results ItemID and value being the quantity returned
+]]
+local function ProspectMe:AddEntry (ItemID, ...)
+	if not ProspectMe[ItemID] then
+		ProspectMe[ItemID] = {}
 	end
-}
-
-
+	for k, v in pairs arg do
+		if not ProspectMe[ItemID][k] then
+			ProspectMe[ItemID][k] = v
+		else
+			ProspectMe[ItemID][k] = ProspectMe[ItemID][k] = v
+		end
+	end
+	return true
+end
 
 
 local PROSPECT_ID = 31252