Buffer:newBlob

Edit

Downloads the Buffer's data from VRAM and returns it as a Blob. This is similar to Buffer:getData, but returns a Blob instead of a table.

blob = Buffer:newBlob(offset, extent)

Arguments

NameTypeDefaultDescription
offsetnumber0 An offset in the Buffer to read from, in bytes.
extentnumbernil The number of bytes to read. If nil, reads the remainder of the buffer.

Returns

NameTypeDescription
blobBlob A new Blob with the Buffer's data.

Notes

This function is very slow, because it stalls the CPU until the data has finished downloading from the GPU. The stall can be avoided be calling this function in a task, which will put the task to sleep until the data is ready. See lovr.task for more details.

See also