@@ -16,6 +16,8 @@ local UnitIsVisible = UnitIsVisible
1616local UnitSelectionType = UnitSelectionType
1717local UnitThreatSituation = UnitThreatSituation
1818
19+ local validator = CreateFrame (' Frame' )
20+
1921function Private .argcheck (value , num , ...)
2022 assert (type (num ) == ' number' , " Bad argument #2 to 'argcheck' (number expected, got " .. type (num ) .. ' )' )
2123
@@ -44,8 +46,6 @@ function Private.unitExists(unit)
4446 return unit and (UnitExists (unit ) or UnitIsVisible (unit ))
4547end
4648
47- local validator = CreateFrame (' Frame' )
48-
4949function Private .validateUnit (unit )
5050 local ok = pcall (UnitHealth , unit )
5151 if not ok then return end
@@ -77,15 +77,17 @@ function Private.isUnitEvent(event, unit)
7777 return isOK
7878end
7979
80- local validSelectionTypes = {}
81- for _ , selectionType in next , oUF .Enum .SelectionType do
82- validSelectionTypes [selectionType ] = selectionType
83- end
80+ do
81+ local validSelectionTypes = {}
82+ for _ , selectionType in next , oUF .Enum .SelectionType do
83+ validSelectionTypes [selectionType ] = selectionType
84+ end
8485
85- function Private .unitSelectionType (unit , considerHostile )
86- if (considerHostile and UnitThreatSituation (' player' , unit )) then
87- return 0
88- else
89- return validSelectionTypes [UnitSelectionType (unit , true )]
86+ function Private .unitSelectionType (unit , considerHostile )
87+ if (considerHostile and UnitThreatSituation (' player' , unit )) then
88+ return 0
89+ else
90+ return validSelectionTypes [UnitSelectionType (unit , true )]
91+ end
9092 end
9193end
0 commit comments