Condition

Parameters
func code

A function that returns boolean or null.

comment

Returns a new conditionfunc, when called by the game returns the result of evaluating func(). func will receive no arguments and must return a boolean: true/false.

note

1.32.10, Lua: conditionfunc extends from boolexpr->agent and must be explicitly destroyed with DestroyBoolExpr/DestroyCondition to prevent leaks. However, most functions from blizzard.j destroy passed boolexpr automatically.

note

Lua: Always returns a new handle unless the passed parameter is nil, in this case it MAY return the same handle depending on unknown conditions (consecutive calls are likely to reuse previous handle).

Jass: Returns same handle when creating multiple filters for the same function: Condition(function foo) == Condition(function foo) ("foo" can be non-constant and constant).

For this reason, do not destroy filterfuncs created with Condition in Jass, in the best case it does nothing but in the worst case it would affect some internals.

This behavior is similar to Filter.

pure
This function is pure. For the same values passed to it, it will always return the same value.
note

See: And, Or, Not, Condition, Filter, DestroyCondition

patch

1.00

Source
common.j
return type
conditionfunc
Source code
native Condition        takes code func returns conditionfunc