Builtin Library
- ..
- .metadata170 B
- README.md2.2 KB
- abs.procNode
- acos.procNode
- add.procNode
- asin.procNode
- atan.procNode
- atan2.procNode
- bor.procNode
- bxor.procNode
- ceil.procNode
- clamp.procNode
- compare.procNode
- concat.procNode
- cos.procNode
- cosh.procNode
- cross.procNode
- deg.procNode
- div.procNode
- dot.procNode
- eq.procNode
- exp.procNode
- floor.procNode
- floordiv.procNode
- fmod.procNode
- frexp.procNode
- ge.procNode
- gt.procNode
- isfinite.procNode
- isinf.procNode
- isnan.procNode
- ldexp.procNode
- le.procNode
- length.procNode
- lerp.procNode
- log.procNode
- log10.procNode
- lt.procNode
- map.procNode
- max.procNode
- min.procNode
- mod.procNode
- modf.procNode
- mul.procNode
- ne.procNode
- neg.procNode
- noise.procNode
- normalize.procNode
- pow.procNode
- rad.procNode
- round.procNode
- shl.procNode
- sign.procNode
- sin.procNode
- sinh.procNode
- smoothstep.procNode
- sqrt.procNode
- sub.procNode
- tan.procNode
- tanh.procNode
- to_float.procNode
- to_int.procNode
- vec2.procNode
- vec3.procNode
- vec4.procNode
- where.procNode
README.md
math
One node per operator and per function of Luau's math table that is a function of its numbers alone: add, sub, mul, div, mod, pow, neg, abs, min, max, floor, ceil, round, sqrt, sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, exp, log, log10, fmod, ldexp, frexp, modf, noise, map, sign, deg, rad, clamp, lerp, smoothstep, isnan, isinf, isfinite, length, normalize, dot, cross, vec2, vec3, vec4, the comparisons (lt, le, gt, ge, eq, ne, and compare over them), where, the integer functions (to_int, to_float, bor, bxor, shl, floordiv), and concat for text. math.random and math.randomseed have no node: they draw from state outside the graph, a graph that called one would cook differently each time, and a call of either in a graph is refused, naming field.rand, field.random and rand.unit, which draw from a seed.
Operators and math.* over sockets resolve to these nodes, and vector.create over sockets resolves to math.vec2, math.vec3 or math.vec4 by its component count; with plain numbers only, math.* and vector.create are Luau's own, and vector.create holds three components. Each node but compare (built from the comparisons) and concat (text) calls an operation of proc.fieldc.operators: over plain numbers and vectors it answers the plain result, over a Column or a Field it answers a Field (a fieldc template), so a chain of math nodes is one expression that the node consuming it evaluates in a single dispatch (fieldc.evaluate).
math.min and math.max over sockets take any number of operands, folded two at a time; math.log(x, base) is the log node with its base. Operands of different widths widen to the widest: a number applies to every component, and a shorter vector reads 0 for the components it lacks. Division, floordiv, mod and fmod by 0 answer 0, sqrt, log and log10 of a value at or below 0 answer 0, asin and acos of a value past -1 or 1 read the nearest of the two, and map over an input range of no width answers its output minimum, so a chain keeps producing numbers. The orderings (lt, le, gt, ge) compare first components; eq and ne compare every component.