globals
private integer array BlackList
private integer StackLevel=0
endglobals
private function AddToList takes integer id returns nothing
set StackLevel=StackLevel+1 // Not giving value to "BlackList[0]"
set BlackList[StackLevel]=id
endfunction
private function Filter takes unit toFilter returns boolean
local integer id=GetUnitTypeId(toFilter)
local integer i=1
loop
exitwhen i>StackLevel
if id==BlackList<i> then
return false
endif
set i=i+1
endloop
return true
endfunction</i>
Dude learn jass more and then come to make scripts, arrays are your best friend. Do as luorax says.
Try to make more things with arrays until you learn them for good. Don't stop only on what they give you.
library Test requires Table initializer OnInit
globals
private Table UnitTypeFilter
endglobals
function BlacklistUnitType takes integer uid returns nothing
set UnitTypeFilter[uid]=1
endfunction
function IsUnitTypeBlacklisted takes integer uid returns boolean
return UnitTypeFilter[uid]==1
endfunction
private function OnInit takes nothing returns nothing
set UnitTypeFilter=Table.create()
endfunction
endlibrary