Buffer.fromstring

From GiderosMobile
Revision as of 02:39, 6 February 2025 by MoKaLux (talk | contribs) (Created page with "__NOTOC__ '''Available since:''' Gideros 2025.1<br/> '''Class:''' buffer_luau<br/> === Description === Creates a buffer initialized to the contents of the string. The siz...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2025.1
Class: buffer_luau

Description

Creates a buffer initialized to the contents of the string. The size of the buffer equals the length of the string.

(buffer) = buffer.fromstring(str)

Parameters

str: (string) a string which length sets the size of the buffer

Return values

Returns (buffer) the created buffer

Example

local str = "Hello Gideros!"
local b = buffer.fromstring(str)
print(buffer.len(b))