comparison 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
comparison
equal deleted inserted replaced
37:ef22738aebfe 38:aa2f6965c0f6
9 9
10 -- DEBUG Print 10 -- DEBUG Print
11 function A.DEBUG(msg) 11 function A.DEBUG(msg)
12 -- GLOBALS: DEFAULT_CHAT_FRAME 12 -- GLOBALS: DEFAULT_CHAT_FRAME
13 DEFAULT_CHAT_FRAME:AddMessage(msg or "nil",1,0,0) 13 DEFAULT_CHAT_FRAME:AddMessage(msg or "nil",1,0,0)
14 end -- function
15
16 -- Messages to the user
17 function A.Warn(msg)
18 if not msg then return end
19 local event = "UI_INFO_MESSAGE"
20 UIErrorsFrame_OnEvent(UIErrorsFrame, event, msg)
21 end -- function
22 function A.Error(msg)
23 if not msg then return end
24 local event = "UI_ERROR_MESSAGE"
25 UIErrorsFrame_OnEvent(UIErrorsFrame, event, msg)
14 end -- function 26 end -- function
15 27
16 -- Returns the item ID from its link 28 -- Returns the item ID from its link
17 function A.link2ID(link) 29 function A.link2ID(link)
18 return tonumber(select(3,sfind(link or "", "-*:(%d+)[:|].*")) or "") 30 return tonumber(select(3,sfind(link or "", "-*:(%d+)[:|].*")) or "")