Functions for manipulating buffers and streams.
Static methods
staticcopy_buffer(dst:Buffer, dstoffset:Int, src:Buffer, srcoffset:Int, count:Int):Void
Copy all data streams from one buffer to another, element wise.
Each of the source streams must have a matching stream in the destination buffer. The streams must match in both type and size. The source and destination buffer can be the same.
Parameters:
dst | the destination buffer |
---|---|
dstoffset | the offset to start copying data to |
src | the source data buffer |
srcoffset | the offset to start copying data from |
count | the number of elements to copy |
staticcopy_stream(dst:BufferStream, dstoffset:Int, src:BufferStream, srcoffset:Int, count:Int):Void
Copy a specified amount of data from one stream to another.
The value type and size must match between source and destination streams. The source and destination streams can be the same.
Parameters:
dst | the destination stream |
---|---|
dstoffset | the offset to start copying data to (measured in value type) |
src | the source data stream |
srcoffset | the offset to start copying data from (measured in value type) |
count | the number of values to copy (measured in value type) |
staticcreate(element_count:Int, declaration:Table<Int, BufferStreamDeclaration>):Buffer
Create a new data buffer containing a specified set of streams. A data buffer can contain one or more streams with typed data. This is useful for managing compound data, for instance a vertex buffer could contain separate streams for vertex position, color, normal etc.
Parameters:
element_count | The number of elements the buffer should hold |
---|---|
declaration | A table where each entry (table) describes a stream |
staticget_bytes(buffer:Buffer, stream_name:HashOrString):String
Get a copy of all the bytes from a specified stream as a Lua string.
Parameters:
buffer | the source buffer |
---|---|
stream_name | the name of the stream |
Returns:
the buffer data as a Lua string
staticget_stream(buffer:Buffer, stream_name:HashOrString):BufferStream
Get a specified stream from a buffer.
Parameters:
buffer | the buffer to get the stream from |
---|---|
stream_name | the stream name |
Returns:
the data stream