Log inGet started
Package

value.nodebox

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

value.expr (procNode)

A number that follows one Luau expression over the graph's clock: t (seconds), frame, fps, duration, pi, the math functions by bare name (abs, acos, asin, atan, ceil, cos, deg, exp, floor, log, max, min, rad, sign, sin, sqrt, tan), clamp, lerp(a, b, k), smoothstep(a, b, x), noise(x, seed) and the names variables gives. The expression is run once with those names bound to sockets, so it becomes arithmetic in the graph: it follows the clock on every present and re-cooks nothing.

Inputs

  • variables (Record, optional): the names the expression reads beyond the built-in ones, each a number, a graph input or another node's number. A built-in name is read before a variable of the same name.
  • expression (String, default "t"): one Luau expression, written without return. An empty expression is refused, and one that does not compile is refused with the compiler's message.

Outputs

  • value (Float): the expression's value.

Example

local bob = g.value.expr({ expression = "height * sin(t * speed)", variables = { height = 0.5, speed = 2 } })