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:getF32 | Unpack 32-bit floating point numbers from the Blob. |
| Blob:getF64 | Unpack 64-bit floating point numbers from the Blob. |
| Blob:getI16 | Unpack signed 16-bit integers from the Blob. |
| Blob:getI32 | Unpack signed 32-bit integers from the Blob. |
| Blob:getI8 | Unpack signed 8-bit integers from the Blob. |
| Blob:getName | Get the label of the Blob. |
| Blob:getPointer | Get a raw pointer to the Blob's data. |
| Blob:getSize | Get the size of the Blob, in bytes. |
| Blob:getString | Get the Blob's contents as a string. |
| Blob:getU16 | Unpack unsigned 16-bit integers from the Blob. |
| Blob:getU32 | Unpack unsigned 32-bit integers from the Blob. |
| Blob:getU8 | Unpack unsigned 8-bit integers from the Blob. |
| Blob:setF32 | Write 32-bit floating point numbers to the Blob. |
| Blob:setF64 | Write 64-bit floating point numbers to the Blob. |
| Blob:setI16 | Write 16-bit signed integers to the Blob. |
| Blob:setI32 | Write 32-bit signed integers to the Blob. |
| Blob:setI8 | Write 8-bit signed integers to the Blob. |
| Blob:setU16 | Write 16-bit unsigned integers to the Blob. |
| Blob:setU32 | Write 32-bit unsigned integers to the Blob. |
| Blob:setU8 | Write 8-bit unsigned integers to the Blob. |
| Object:release | Immediately release the Lua reference to an object. |
| Object:type | Get the type name of the object. |