Buffer.resize

From GiderosMobile

Available since: Gideros 2025.1
Class: buffer_luau

Description

Resizes the buffer and creates a new one.

(buffer) = buffer.resize(b,newSize,offset)

Parameters

b: (buffer) the buffer
newSize: (number) the new buffer size
offset: (number) offset from the beginning of the buffer memory, starting from 0 optional

Return values

Returns (buffer) a new buffer with the new size

Examples

local b = buffer.create(16)
b = buffer.resize(b, 48, 16)
print(buffer.len(b))

local mystr = "Hello Gideros!"
local b2 = buffer.fromstring(mystr)
b2 = buffer.resize(b2, 48, 0)
print(buffer.tostring(b2))