Blob
EditA Blob is an object that holds binary data. It can be passed to most functions that take filename arguments, like lovr.graphics.newModel or lovr.audio.newSource. Blobs aren't usually necessary for simple projects, but they can be really helpful if:
- You need to work with low level binary data, potentially using the LuaJIT FFI for increased performance.
- You are working with data that isn't stored as a file, such as programmatically generated data or a string from a network request.
- You want to load data from a file once and then use it to create many different objects.
A Blob's size cannot be changed once it is created.
Constructors
| lovr.data.newBlob | Create a new Blob. |
| lovr.filesystem.newBlob | Create a new Blob from a file. |
Methods
| Blob:getSize | Get the size of the Blob, in bytes. |
| Blob:getName | Get the label of the Blob. |
| Blob:getPointer | Get a raw pointer to the Blob's data. |
| Blob:getString | Get the Blob's contents as a string. |
| Blob:getI8 | Unpack signed 8-bit integers from the Blob. |
| Blob:getU8 | Unpack unsigned 8-bit integers from the Blob. |
| Blob:getI16 | Unpack signed 16-bit integers from the Blob. |
| Blob:getU16 | Unpack unsigned 16-bit integers from the Blob. |
| Blob:getI32 | Unpack signed 32-bit integers from the Blob. |
| Blob:getU32 | Unpack unsigned 32-bit integers from the Blob. |
| Blob:getF32 | Unpack 32-bit floating point numbers from the Blob. |
| Blob:getF64 | Unpack 64-bit floating point numbers from the Blob. |