Difference between revisions of "love.data.newByteData"

(Created page)
 
m (0.11.0 -> 11.0)
Line 1: Line 1:
{{newin|[[0.11.0]]|110|type=function}}
+
{{newin|[[11.0]]|110|type=function}}
 
Creates a new Data object containing arbitrary bytes.
 
Creates a new Data object containing arbitrary bytes.
  

Revision as of 18:10, 7 May 2019

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 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