Log inGet started

substrate

The substrate namespace — the engine's Luau API reference for substrate.

The substrate namespace — 1 function.

substrate/createBuffer

substrate.createBuffer({ kind?, type, len, usage? }) -> handle | nil

Allocate a typed substrate buffer. Returns a handle wrapping :write(slice, offset?), :read(...), :length(), :type(), :kind(), :destroy(). type is one of "f32", "vec3", "vec4", "quat", "mat4" (case-insensitive). kind defaults to "cpu". When kind = "gpu", usage is an optional array of flags ("vertex", "index", "readback") that translate to wgpu usage bits — "storage" is implicit. CPU :read returns a flat float table; GPU :read returns a readback key string for polling via compute.getReadbackResult(key). CPU handles expose :bytes() — a Luau-native buffer userdata pinned to the substrate buffer's storage; iterate it via buffer.readf32(bufR:bytes(), byte_off) / buffer.writef32(bufR:bytes(), byte_off, v) for fast per-element access.

  • api
  • reference