I have a problem with structs. An example might come handy:
The above script does not generate any error, but no unit gets filtered and the code stops.
Maybe you're not able to call functions from inside a struct?
I've tried this way (below) too, but it doesn't work either.
Tried this too but it also generates syntax error.
...and also:
What is the proper way to do it?
JASS:
function SomeFilter takes nothing returns boolean
return SomeCondition
endfunction
struct someStruct
unit u
group g
method someMethod takes nothing returns unit
local someStruct some
local filterfunc filter = Filter(function SomeFilter)
call GroupEnumUnitsInRect(some.g, bj_mapInitialPlayableArea, filter)
set some.u = FirstOfGroup(g)
endmethod
endstruct
Maybe you're not able to call functions from inside a struct?
I've tried this way (below) too, but it doesn't work either.
JASS:
struct someStruct
unit u
group g
method someFilter takes nothing returns boolean
return someCondition
endmethod
method someMethod takes nothing returns unit
local someStruct some
local filterfunc filter = Filter(some.SomeFilter) //Syntax Error
call GroupEnumUnitsInRect(some.g, bj_mapInitialPlayableArea, filter)
set some.u = FirstOfGroup(some.g)
endmethod
endstruct
Tried this too but it also generates syntax error.
JASS:
local filterfunc filter = Filter(method some.SomeFilter)
...and also:
JASS:
local filterfunc filter = Filter(function some.SomeFilter)
What is the proper way to do it?