Copy all or part of one buffer to another.


GML Code Example

buffer_copy(src_buffer, src_offset, size, dest_buffer, dest_offset);

Argument Description
src_buffer The index of the buffer to copy from.
src_offset The data offset to start copying from (in bytes).
size The size of the data to copy (in bytes).
dest_buffer The index of the buffer to copy to.
dest_offset The offset position to copy the data to (in bytes).

Returns: N/A


This function can be used to copy a segment (or all) of the data stored in one buffer to another. When using two buffers and copying from one to the other, both buffers must have previously been created using the buffer_create function (for example), and you can specify a data offset (in bytes) for the start point of the data to be copied from the source buffer relative to the start of the buffer, as well as another data offset to define the position to copy the data to in the destination buffer.

NOTE: You cannot copy to the same buffer.


GML Code Example

buffer_copy(buff1, 0, 2048, buff2, 2048);

The above code will copy the data stored in the buffer indexed in the variable "buff1", and then paste it into the buffer indexed in the variable "buff2", but offset by 2048 bytes.

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here