Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

blobs

Generic binary staging for handing bytes to native components. Content reads a file's bytes (vfs.read, binary-safe, yields until the blob is resident), stages them with set, and passes the returned handle through a component field; the native consumer takes the bytes back by that handle and owns its copy. Component field values travel as JSON (UTF-8 only), so a raw binary payload rides as a staged handle — the CPU-side analogue of the mesh/texture GPU upload.

Methods

  • blobs.set(bytes) -> handle — stage a binary payload, get a short string handle to pass through a component field.
  • blobs.get(handle) -> bytes? — read back a copy of the staged bytes without removing them; nil for an unknown or already-cleared handle.
  • blobs.clear(handle) — drop a staged payload that will not be consumed, freeing its memory.

Usage

local bytes = vfs.read(clipPath .. "/data.zaud")
local handle = ecs.blobs.set(bytes)
ecs.insertSync(id, ecs.AudioSource { clip = clip, bytesHandle = handle })