Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

value

Single values a graph computes with. A measurement turns into something a loop stops on, a count another node takes, or anything a switch decides.

procgen.searchNodes("", { pack = "value" }) lists the family and procgen.describeNode("op.<id>") describes any one of them.

Ops

  • value.get — one field of a Data or record value, by a dotted path such as bounds.max.y. When the path misses, the error names the fields that are there.
  • value.math — a <op> b for add, sub, mul, div, min, max or pow. b is a wire or the constant param.
  • value.expr — a number that follows an expression over the graph's time (t, frame, the math functions) and the names variables gives it, each a constant, a graph input or another node's number. A curve that depends on graph inputs is this one node: { variables = { peak = peak, decay = decay } } with expression = "peak * max(0, 1 - t / decay) ^ 2".
  • value.compare — a <op> b for less, less_equal, greater, greater_equal, equal or not_equal, answering a Bool.
  • value.switch: ifTrue when when is true, ifFalse otherwise. Only the one taken is cooked.
  • value.present: whether anything is wired into value, as a Bool: what a graph used as a node asks of an input its caller may leave unwired.
  • value.fallback: the value wired into value, or fallback when nothing is. fallback is cooked only when it is the one taken.
local stats = g.op.geometry.measure({ geometry = grown })
local top = g.op.value.get({ data = stats, path = "bounds.max.y" })
local done = g.op.value.compare({ a = top, op = "greater_equal", constant = 3 })