Buffer:mapData

Edit

Returns a pointer to GPU memory and schedules a copy from this pointer to the buffer's data. The data in the pointer will replace the data in the buffer. This is intended for use with the LuaJIT FFI or for passing to C libraries.

pointer = Buffer:mapData(offset, extent)

Arguments

NameTypeDefaultDescription
offsetnumber0 A byte offset in the buffer to write to.
extentnumbernil The number of bytes to replace. If nil, writes to the rest of the buffer.

Returns

NameTypeDescription
pointerlightuserdata A pointer to the Buffer's memory.

Notes

The pointer remains valid until the next call to lovr.graphics.submit, during which the data in the pointer will be uploaded to the buffer.

The initial contents of the pointer are undefined.

Special care should be taken when writing data:

See also