-
Notifications
You must be signed in to change notification settings - Fork 0
/
logical.lua
44 lines (42 loc) · 1019 Bytes
/
logical.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
local addon, dark_addon = ...
dark_addon.environment.logical = {
prefixes = {
'^player',
'^pet',
'^vehicle',
'^target',
'^focus',
'^mouseover',
'^none',
'^npc',
'^party[1-4]',
'^raid[1-4]?[0-9]',
'^boss[1-5]',
'^arena[1-5]'
}
}
function dark_addon.environment.logical.validate(unitID)
local length, offset = string.len(unitID), 0
for i = 1, #dark_addon.environment.logical.prefixes do
local start, index = string.find(unitID, dark_addon.environment.logical.prefixes[i])
if start then
offset = index + 1
if offset > length then
return true
else
while true do
local start, index = string.find(unitID, 'target', offset, true)
if start then
offset = index + 1
if offset > length then
return true
end
else
return false
end
end
end
end
end
return false
end