Difference between revisions of "Buffer.readstring"
From GiderosMobile
(wip) |
|||
Line 19: | Line 19: | ||
=== Example === | === Example === | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
− | + | local str = "Hello Gideros!" | |
− | local | + | local b = buffer.fromstring(str) |
− | local count = buffer.len(b)- | + | local offset = 6 |
− | print(buffer.readstring(b, | + | local count = buffer.len(b)-offset |
+ | print(buffer.readstring(b, offset, count)) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{buffer_luau}} | {{buffer_luau}} |
Latest revision as of 05:40, 6 February 2025
Available since: Gideros 2025.1
Class: buffer_luau
Description
Reads a string of length count from the buffer at the specified offset.
(string) = buffer.readstring(b,offset,count)
Parameters
b: (buffer) the buffer
offset: (number) offset from the beginning of the buffer memory, starting from 0
count: (number) length to read
Return values
Returns (string) the string from the buffer
Example
local str = "Hello Gideros!"
local b = buffer.fromstring(str)
local offset = 6
local count = buffer.len(b)-offset
print(buffer.readstring(b, offset, count))