Blob:getString
EditReturns a binary string containing the Blob's data.
data = Blob:getString(offset, size)
Arguments
Name | Type | Default | Description |
offset | number | 0 | A byte offset into the Blob where the string will start. |
size | number | nil |
The number of bytes the string will contain. If nil, the rest of the data in the Blob will be used, based on the offset parameter.
|
Returns
Name | Type | Description |
data | string | The Blob's data. |
Notes
This effectively allocates a new copy of the Blob as a Lua string, so this should be avoided for really big Blobs!
Example
Print each byte of the main.lua file:
blob = lovr.filesystem.newBlob('main.lua')
str = blob:getString()
for i = 1, #str do
print(string.byte(str, i))
end