# HG changeset patch # User Vynn # Date 1478590590 18000 # Node ID fc13da07d8e446701e08c5fc5847471d26da384b # Parent c11461d5095c6f78a476674bd3c779a022bbfca0 Cleaned up some code, added comments, refined ProspectMe:AddEntry() diff -r c11461d5095c -r fc13da07d8e4 ProspectMe.lua --- 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