Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

value.compare (procNode)

Two values compared, answering 1 when the comparison holds and 0 when it does not: what a loop's stop reads, or anything a switch decides on. Numbers compare by any op; text and true/false compare by equal and not_equal and must be the same kind. In a graph, g.compare(a, op, b) is the same comparison; this node is for an op picked by a parameter.

Inputs

  • a (Float | Int | String | Bool, default 0): the left operand.
  • b (Float | Int | String | Bool, optional): the right operand. Unwired, it is constant.
  • op (String, default "less"): the comparison, as a <op> b: "less", "less_equal", "greater", "greater_equal", "equal" or "not_equal". The orderings take numbers; equal and not_equal take two numbers, two texts or two true/false values.
  • constant (Float | String | Bool, default 0): the right operand when b is unwired: a number, a text such as a mode's name, or true/false.

Outputs

  • result (Float): 1 when the comparison holds, 0 when it does not.

Example

local tall = g.value.compare({ a = 3.5, op = "greater", constant = 2 })