love.data.newByteData

Available since LÖVE 11.0
This function is not supported in earlier versions.

Creates a new Data object containing arbitrary bytes.

Data:getPointer along with LuaJIT's FFI can be used to manipulate the contents of the ByteData object after it has been created.

O.png This function can be slow if it is called repeatedly, such as from love.update or love.draw. If you need to use a specific resource often, create it once and store it somewhere it can be reused!  



Function

Creates a new ByteData by copying the contents of the specified string.

Synopsis

bytedata = love.data.newByteData( datastring )

Arguments

string datastring
The byte string to copy.

Returns

ByteData bytedata
The new Data object.

Function

Creates a new ByteData by copying from an existing Data object.

Synopsis

bytedata = love.data.newByteData( data, offset, size )

Arguments

Data data
The existing Data object to copy.
number offset (0)
The offset of the subsection to copy, in bytes.
number size (data:getSize())
The size in bytes of the new Data object.

Returns

ByteData bytedata
The new Data object.

Function

Creates a new empty (zero-initialized) ByteData with the specific size.

Synopsis

bytedata = love.data.newByteData( size )

Arguments

number size
The size in bytes of the new Data object.

Returns

ByteData bytedata
The new Data object.

See Also

Other Languages