channel
The channel namespace — 19 functions.
globals/channel/create
channel.create(opts: ChannelOpts) -> number?
Register a keyframe channel. times is the sorted keyframe
time array; values is the packed value array (layout depends
on interp); stride is the floats-per-sample width; interp
is "step" | "linear" | "slerp" | "cubicHermite". Returns
the channel handle, or nil on malformed input.
Parameters
optsChannelOpts—{ times, values, stride, interp }.
Returns number? — Channel handle, or nil.
local h = channel.create({ times = ts, values = vs, stride = 3, interp = "linear" })
globals/channel/destroy
channel.destroy(handle: number) -> boolean
Drop the channel from the registry.
Parameters
handlenumber— Channel handle.
Returns boolean — True if the channel existed and was removed.
globals/channel/sampleInto
channel.sampleInto(ch: number, time: number, buf: Substrate.TypedBuffer, offset: number) -> boolean
Sample the channel at time and write stride floats into
the buffer starting at f32 index offset. Returns false
on unknown handle, layout mismatch, or out-of-bounds; the
buffer is unchanged on failure.
Parameters
chnumber— Channel handle.timenumber— Sample time in seconds.bufSubstrate.TypedBuffer— The buffer written into.offsetnumber— Starting f32 index in the buffer.
Returns boolean — True on success.
globals/channel/sampleManyInto
channel.sampleManyInto(ch: number, time: number, buf: Substrate.TypedBuffer, offsets: { number }) -> boolean
Sample once, blit the result into every position in
offsets. Saves the per-offset binary search when one channel
feeds many bones / particles / parameters.
Parameters
chnumber— Channel handle.timenumber— Sample time in seconds.bufSubstrate.TypedBuffer— The buffer written into.offsets{ number }— Array of f32 indices.
Returns boolean — True on success.
globals/channel/sampleQuat
channel.sampleQuat(ch: number, time: number) -> (number?, number?, number?, number?)
Convenience accessor for stride-4 quaternion channels.
Parameters
chnumber— Channel handle.timenumber— Sample time.
Returns (number?, number?, number?, number?) — (x, y, z, w) or nil.
globals/channel/sampleVec3
channel.sampleVec3(ch: number, time: number) -> (number?, number?, number?)
Convenience accessor for stride-3 channels. Returns the three components as multiret, or nil if the channel is unknown / has a different stride.
Parameters
chnumber— Channel handle.timenumber— Sample time.
Returns (number?, number?, number?) — (x, y, z) or nil.
local x, y, z = channel.sampleVec3(h, t)
modules/channel/README
require("@builtin/modules/api/engine/channel") -- channel (also available as global 'channel')
Keyframe-channel sampling primitives — registry + sampleInto variants. Public Luau surface over the __channel Internal FFI namespace.
Usage: local channel = require("@builtin/modules/api/engine/channel") Also available as global: channel
modules/channel/create
create(opts: ChannelOpts): number?
Register a keyframe channel. times is the sorted keyframe
time array; values is the packed value array (layout depends
on interp); stride is the floats-per-sample width; interp
is "step" | "linear" | "slerp" | "cubicHermite". Returns
the channel handle, or nil on malformed input.
Parameters
optsChannelOpts—{ times, values, stride, interp }.
local h = channel.create({ times = ts, values = vs, stride = 3, interp = "linear" })
modules/channel/destroy
destroy(handle: number): boolean
Drop the channel from the registry.
Parameters
handlenumber— Channel handle.
modules/channel/sampleInto
sampleInto(ch: number, time: number, buf: Substrate.TypedBuffer, offset: number): boolean
Sample the channel at time and write stride floats into
the buffer starting at f32 index offset. Returns false
on unknown handle, layout mismatch, or out-of-bounds; the
buffer is unchanged on failure.
Parameters
chnumber— Channel handle.timenumber— Sample time in seconds.bufSubstrate.TypedBuffer— The buffer written into.offsetnumber— Starting f32 index in the buffer.
modules/channel/sampleManyInto
sampleManyInto(ch: number, time: number, buf: Substrate.TypedBuffer, offsets: { number }): boolean
Sample once, blit the result into every position in
offsets. Saves the per-offset binary search when one channel
feeds many bones / particles / parameters.
Parameters
chnumber— Channel handle.timenumber— Sample time in seconds.bufSubstrate.TypedBuffer— The buffer written into.offsets{ number }— Array of f32 indices.
modules/channel/sampleQuat
sampleQuat(ch: number, time: number): (number?, number?, number?, number?)
Convenience accessor for stride-4 quaternion channels.
Parameters
chnumber— Channel handle.timenumber— Sample time.
modules/channel/sampleVec3
sampleVec3(ch: number, time: number): (number?, number?, number?)
Convenience accessor for stride-3 channels. Returns the three components as multiret, or nil if the channel is unknown / has a different stride.
Parameters
chnumber— Channel handle.timenumber— Sample time.
local x, y, z = channel.sampleVec3(h, t)
typed/builtin//modules/api/engine/channel/channel/create
channel.create(opts: ChannelOpts) -> number?
Register a keyframe channel. times is the sorted keyframe
time array; values is the packed value array (layout depends
on interp); stride is the floats-per-sample width; interp
is "step" | "linear" | "slerp" | "cubicHermite". Returns
the channel handle, or nil on malformed input.
Parameters
optsChannelOpts—{ times, values, stride, interp }.
Returns number? — Channel handle, or nil.
local h = channel.create({ times = ts, values = vs, stride = 3, interp = "linear" })
typed/builtin//modules/api/engine/channel/channel/destroy
channel.destroy(handle: number) -> boolean
Drop the channel from the registry.
Parameters
handlenumber— Channel handle.
Returns boolean — True if the channel existed and was removed.
typed/builtin//modules/api/engine/channel/channel/sampleInto
channel.sampleInto(ch: number, time: number, buf: Substrate.TypedBuffer, offset: number) -> boolean
Sample the channel at time and write stride floats into
the buffer starting at f32 index offset. Returns false
on unknown handle, layout mismatch, or out-of-bounds; the
buffer is unchanged on failure.
Parameters
chnumber— Channel handle.timenumber— Sample time in seconds.bufSubstrate.TypedBuffer— The buffer written into.offsetnumber— Starting f32 index in the buffer.
Returns boolean — True on success.
typed/builtin//modules/api/engine/channel/channel/sampleManyInto
channel.sampleManyInto(ch: number, time: number, buf: Substrate.TypedBuffer, offsets: { number }) -> boolean
Sample once, blit the result into every position in
offsets. Saves the per-offset binary search when one channel
feeds many bones / particles / parameters.
Parameters
chnumber— Channel handle.timenumber— Sample time in seconds.bufSubstrate.TypedBuffer— The buffer written into.offsets{ number }— Array of f32 indices.
Returns boolean — True on success.
typed/builtin//modules/api/engine/channel/channel/sampleQuat
channel.sampleQuat(ch: number, time: number) -> (number?, number?, number?, number?)
Convenience accessor for stride-4 quaternion channels.
Parameters
chnumber— Channel handle.timenumber— Sample time.
Returns (number?, number?, number?, number?) — (x, y, z, w) or nil.
typed/builtin//modules/api/engine/channel/channel/sampleVec3
channel.sampleVec3(ch: number, time: number) -> (number?, number?, number?)
Convenience accessor for stride-3 channels. Returns the three components as multiret, or nil if the channel is unknown / has a different stride.
Parameters
chnumber— Channel handle.timenumber— Sample time.
Returns (number?, number?, number?) — (x, y, z) or nil.
local x, y, z = channel.sampleVec3(h, t)