Null filter

XeRo13g

New Member
Reaction score
3
JASS:
call TriggerRegisterUnitInRange(gg_trg_trigger1,udg_unit,250,null)


As far as I know, using a null filter leaks, so I've tried to get rid of it by using a function that returns true.

JASS:
function noleak takes nothing returns boolean
return true
endfunction


Can I use this:
JASS:
call TriggerRegisterUnitInRange(gg_trg_trigger1,udg_unit,250,Filter(function noleak))


..or do I have to set the filter into a variable and destroy/null it aftewards?
 

Laiev

Hey Listen!!
Reaction score
188
>>As far as I know, using a null filter leaks

Not anymore :p Blizzard fixed [ljass]boolexpr[/ljass] leak some patchs ago

And yes, your 'noleak' function would work fine.
 

XeRo13g

New Member
Reaction score
3
Just for safety, I've set it into a variable. I'll just go back and use "null" then.

Thanks much +rep
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
click boolexpr in laievs post, at the bottom it explains that in fact they did get rid of the leak
 

XeRo13g

New Member
Reaction score
3
>>As far as I know, using a null filter leaks

Not anymore :p Blizzard fixed [ljass]boolexpr[/ljass] leak some patchs ago

And yes, your 'noleak' function would work fine.

Alright, I'll post here since this belongs to this thread....

Null filters is one thing but after taking a look in several threads and various codes, I always see this:

JASS:
local filterfunc f=Filter(function function_name)


If it doesn't leak, why is that everyone use this, instead of the direct:

JASS:
call GroupEnumUnitsInRange(group,x,y,range,Filter(function function_name))


:(
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
sorry but i didnt quite understand the question, while both of those use filters im not sure how the second example is less direct if they are wanting to get units in a group with a specific filter, actually im almost positive the first is less direct in all cases since it is a local, all they are going to do is this:

[ljass]local filterfunc f = Filter(function somefilterfunc)[/ljass]
[ljass]call SomeCall(something, something, f)[/ljass]
[ljass]set f = null[/ljass]

when you could do:

[ljass]call SomeCall(something, something, Filter(function somefilterfunc))[/ljass]

why use a local if you will have to null it after and it risks leaks?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top