Difference between revisions of "ByteData"

(Crated page)
 
(Add usage)
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{newin|[[0.11.0]]|110|type=type}}
+
{{newin|[[11.0]]|110|type=type}}
 
Data object containing arbitrary bytes in an contiguous memory.
 
Data object containing arbitrary bytes in an contiguous memory.
  
 
There are currently no LÖVE functions provided for manipulating the contents of a ByteData, but [[Data:getPointer]] can be used with LuaJIT's FFI to access and write to the contents directly.
 
There are currently no LÖVE functions provided for manipulating the contents of a ByteData, but [[Data:getPointer]] can be used with LuaJIT's FFI to access and write to the contents directly.
 +
Used primarily for creating [[ImageData]], [[Image]], also [[love.filesystem.mount]] etc.
  
 
== Constructors ==
 
== Constructors ==

Revision as of 20:52, 31 December 2019

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

Data object containing arbitrary bytes in an contiguous memory.

There are currently no LÖVE functions provided for manipulating the contents of a ByteData, but Data:getPointer can be used with LuaJIT's FFI to access and write to the contents directly. Used primarily for creating ImageData, Image, also love.filesystem.mount etc.

Constructors

love.data.newByteData Creates a new Data object containing arbitrary bytes. Added since 11.0

Functions

ByteData:setString Replaces all or part of the ByteData's memory with the contents of a string. Added since 12.0
Data:clone Creates a new copy of the Data object. Added since 11.0
Data:getFFIPointer Gets an FFI pointer to the Data. Added since 11.3
Data:getPointer Gets a pointer to the Data.
Data:getSize Gets the Data's size in bytes.
Data:getString Gets the full Data as a string. Added since 0.9.0
Object:release Immediately destroys the object's Lua reference. Added since 11.0
Object:type Gets the type of the object as a string.
Object:typeOf Checks whether an object is of a certain type.

Supertypes

See Also

Other Languages