Difference between revisions of "Buffer.create"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2025.1<br/> '''Class:''' buffer_luau<br/> === Description === Creates a buffer of the requested size with all bytes initialized t...")
 
(No difference)

Latest revision as of 01:22, 6 February 2025

Available since: Gideros 2025.1
Class: buffer_luau

Description

Creates a buffer of the requested size with all bytes initialized to 0. Size limit is 1 GiB, or 1,073,741,824 bytes. Keep in mind that larger buffers might fail to allocate if device is running low on memory.

(buffer) = buffer.create(size)

Parameters

size: (number) the size of the buffer

Return values

Returns (buffer) the created buffer

Example

-- creates a buffer of the requested size with all bytes initialized to 0
local b: buffer = buffer.create(16)
print(buffer.len(b))