BlueMirage
Trust, but doubt.
- Reaction score
- 39
I'm trying to make a function that will make it easier to sort out units of a group that I don't want, so I'm making a function that will do so.
It looks something like this at the moment:
The problem that I have is that if the function takes a boolean, I think that the boolean is set to true or false when I input it in the "takes" part. So, I think I have to use a boolean expression instead. I'm not sure if that's the solution, but my guess is that an expression does not have a true or false value as a variable, but will rather give one when used. Problem is, I don't know how to, as I can't compare "b" with TRUE.
Any ideas on how to create this?
I'm quite sure that it leaks, since it uses a unit group that is not cleaned up.
It looks something like this at the moment:
JASS:
function FilterGroup takes group g, boolexpr b returns group
local group g2 = CreateGroup()
local boolean = Condition(
local unit u
loop
set u = FirstOfGroup(g)
exitwhen u == null
if b == TRUE then
call GroupAddUnit(g2, u)
endif
call GroupRemoveUnit(g, u)
endloop
return g2
endfunction
The problem that I have is that if the function takes a boolean, I think that the boolean is set to true or false when I input it in the "takes" part. So, I think I have to use a boolean expression instead. I'm not sure if that's the solution, but my guess is that an expression does not have a true or false value as a variable, but will rather give one when used. Problem is, I don't know how to, as I can't compare "b" with TRUE.
Any ideas on how to create this?
I'm quite sure that it leaks, since it uses a unit group that is not cleaned up.