Buffer.writestring

From GiderosMobile

Available since: Gideros 2025.1
Class: buffer_luau

Description

Writes data from a string into the buffer at the specified offset. If an optional count is specified, only count bytes are taken from the string.

buffer.writestring(b,offset,value,count)

Parameters

b: (buffer) the buffer
offset: (number) offset from the beginning of the buffer memory, starting from 0
value: (string) data to write
count: (number) number of bytes to take from the string. This value cannot be larger than the string length optional

Example

local str = "Hello Gideros!"
local b = buffer.fromstring(str)
local offset = 1
local value = "A"
local count = 1
buffer.writestring(b, offset, value, count)
print(buffer.tostring(b))