diff utils.lua @ 38:aa2f6965c0f6

Add fancy errors/warnings and block recursion when a recipe has many reagents
author contrebasse
date Fri, 29 Apr 2011 23:38:43 +0200
parents 578b9c9479c9
children 00c2282f073a
line wrap: on
line diff
--- a/utils.lua	Fri Apr 29 22:56:49 2011 +0200
+++ b/utils.lua	Fri Apr 29 23:38:43 2011 +0200
@@ -13,6 +13,18 @@
 	DEFAULT_CHAT_FRAME:AddMessage(msg or "nil",1,0,0)
 end -- function
 
+-- Messages to the user
+function A.Warn(msg)
+	if not msg then return end
+	local event = "UI_INFO_MESSAGE"
+	UIErrorsFrame_OnEvent(UIErrorsFrame, event, msg)
+end -- function
+function A.Error(msg)
+	if not msg then return end
+	local event = "UI_ERROR_MESSAGE"
+	UIErrorsFrame_OnEvent(UIErrorsFrame, event, msg)
+end -- function
+
 -- Returns the item ID from its link
 function A.link2ID(link)
 	return tonumber(select(3,sfind(link or "", "-*:(%d+)[:|].*")) or "")