vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -- Utilities |
2 | |||
3 | function lazyr.SplitArgs(line) |
||
4 | local args = {} |
||
5 | for arg in string.gfind(line, "[^%s]+") do |
||
6 | table.insert(args, arg) |
||
7 | end |
||
8 | return args |
||
9 | end |
||
10 | |||
11 | -- Helper regex function. Returns true/false if the pattern matched, |
||
12 | -- and sets the globals lazyr.match1, 2, 3, 4, 5, 6 per your parenthesis matching. |
||
13 | function lazyr.re(text, re) |
||
14 | local starts, ends |
||
15 | starts, ends, lazyr.match1, lazyr.match2, lazyr.match3, lazyr.match4, lazyr.match5, lazyr.match6 = string.find(text, re) |
||
16 | return starts |
||
17 | end |
||
18 | |||
19 | function lazyr.chat(msg, r, g, b) |
||
20 | if (not r) then |
||
21 | r = .9 |
||
22 | g = .6 |
||
23 | b = .05 |
||
24 | end |
||
25 | DEFAULT_CHAT_FRAME:AddMessage(msg, r, g, b) |
||
26 | end |
||
27 | |||
28 | function lazyr.p(msg) |
||
29 | if (lazyr.mock) then |
||
30 | return |
||
31 | end |
||
32 | lazyr.chat("## LazyRogue: "..msg) |
||
33 | lazyr.trace(msg) |
||
34 | end |
||
35 | |||
36 | function lazyr.d(msg) |
||
37 | if (lazyr.mock) then |
||
38 | return |
||
39 | end |
||
40 | if (lazyr.perPlayerConf.debug) then |
||
41 | lazyr.chat("### LazyRogue: "..msg, .8, .5, 0) |
||
42 | end |
||
43 | lazyr.trace(msg) |
||
44 | end |
||
45 | |||
46 | -- provide optional Tracer module support, for debugging problems |
||
47 | function lazyr.trace(msg) |
||
48 | if (tracer) then |
||
49 | tracer.Log("LazyRogue", msg) |
||
50 | end |
||
51 | end |
||
52 | |||
53 | function lazyr.nonil(str) |
||
54 | if (not str) then |
||
55 | str = "" |
||
56 | end |
||
57 | return str |
||
58 | end |
||
59 | |||
60 | function lazyr.IdAndNameFromLink(link) |
||
61 | local name |
||
62 | if (not link) then |
||
63 | return "" |
||
64 | end |
||
65 | for id, name in string.gfind(link, "|c%x+|Hitem:(%d+):%d+:%d+:%d+|h%[(.-)%]|h|r$") do |
||
66 | return tonumber(id), name |
||
67 | end |
||
68 | return nil |
||
69 | end |
||
70 | |||
71 |