diff ReAction.lua @ 286:77609bfa804e stable

Merge 1.1 beta 8 to stable
author Flick
date Sat, 11 Jun 2011 10:57:00 -0700
parents 5b9c0164a491
children 0cb6a9944497
line wrap: on
line diff
--- a/ReAction.lua	Wed May 11 09:53:48 2011 -0700
+++ b/ReAction.lua	Sat Jun 11 10:57:00 2011 -0700
@@ -1,8 +1,9 @@
-local addonName, addonTable = ...
+local _, ns = ...
 local pcall = pcall
 local pairs = pairs
 local type = type
 local geterrorhandler = geterrorhandler
+local GetTime = GetTime
 local L = LibStub("AceLocale-3.0"):GetLocale("ReAction")
 local LKB = LibStub("LibKeyBound-1.0",true)
 if not LKB then
@@ -58,16 +59,16 @@
 end
 
 -- store in the addon table
-addonTable.tcopy = tcopy
-addonTable.tfetch = tfetch
-addonTable.tbuild = tbuild
-addonTable.fieldsort = fieldsort
+ns.tcopy = tcopy
+ns.tfetch = tfetch
+ns.tbuild = tbuild
+ns.fieldsort = fieldsort
 
 ------ Core ------
 local ReAction = LibStub("AceAddon-3.0"):NewAddon( "ReAction",
   "AceEvent-3.0"
 )
-addonTable.ReAction = ReAction
+ns.ReAction = ReAction
 ReAction.version = GetAddOnMetadata("ReAction","Version")
 ReAction.L = L
 ReAction.LKB = LKB
@@ -171,8 +172,17 @@
 
 ------ Methods ------
 
-function ReAction:UserError(msg)
-  UIErrorsFrame:AddMessage(msg)
+do
+  local lastErrorMessage
+  local lastErrorTime
+  function ReAction:UserError(msg)
+    local t = GetTime()
+    if msg ~= lastErrorMessage or lastErrorTime == nil or (t - lastErrorTime > 10) then -- prevent spam
+      UIErrorsFrame:AddMessage(msg)
+      lastErrorMessage = msg
+      lastErrorTime = t
+    end
+  end
 end
 
 function ReAction:GetBar(arg)