Skip to main content

BufferReader

A BufferReader is an abstraction wrapper for buffer objects that provides a convenient way of reading out data from buffers.

Functions

ReadInt8

BufferReader:ReadInt8() → number

Read a signed 8-bit integer from the buffer.

ReadUInt8

BufferReader:ReadUInt8() → number

Read an unsigned 8-bit integer from the buffer.

ReadInt16

BufferReader:ReadInt16() → number

Read a signed 16-bit integer from the buffer.

ReadUInt16

BufferReader:ReadUInt16() → number

Read an unsigned 16-bit integer from the buffer.

ReadInt32

BufferReader:ReadInt32() → number

Read a signed 32-bit integer from the buffer.

ReadUInt32

BufferReader:ReadUInt32() → number

Read an unsigned 32-bit integer from the buffer.

ReadFloat32

BufferReader:ReadFloat32() → number

Read a 32-bit single-precision float from the buffer.

ReadFloat64

BufferReader:ReadFloat64() → number

Read a 64-bit double-precision float from the buffer.

ReadBool

BufferReader:ReadBool() → boolean

Read a boolean from the buffer.

ReadString

BufferReader:ReadString() → string

Read a string from the buffer.

info

This assumes the string was written using the BufferWriter:WriteString() method, which stores an extra integer to mark the size of the string.

ReadStringRaw

BufferReader:ReadStringRaw(lengthnumber) → string

Read a string from the buffer.

info

This assumes the string was written using the BufferWriter:WriteStringRaw().

ReadDataType

BufferReader:ReadDataType(dataTypeT) → T

Read a DataType from the buffer.

local cframe = reader:ReadDataType(CFrame)

SetCursor

BufferReader:SetCursor(positionnumber) → ()

Sets the position of the cursor.

GetCursor

BufferReader:GetCursor() → number

Returns the position of the cursor.

ResetCursor

BufferReader:ResetCursor() → ()

Resets the position of the cursor.

GetSize

BufferReader:GetSize() → number

Returns the size of the buffer.

GetBuffer

BufferReader:GetBuffer() → buffer

Returns the buffer object.

Show raw api
{
    "functions": [
        {
            "name": "ReadInt8",
            "desc": "Read a signed 8-bit integer from the buffer.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 51,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "ReadUInt8",
            "desc": "Read an unsigned 8-bit integer from the buffer.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 61,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "ReadInt16",
            "desc": "Read a signed 16-bit integer from the buffer.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 71,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "ReadUInt16",
            "desc": "Read an unsigned 16-bit integer from the buffer.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 81,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "ReadInt32",
            "desc": "Read a signed 32-bit integer from the buffer.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 91,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "ReadUInt32",
            "desc": "Read an unsigned 32-bit integer from the buffer.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 101,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "ReadFloat32",
            "desc": "Read a 32-bit single-precision float from the buffer.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 111,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "ReadFloat64",
            "desc": "Read a 64-bit double-precision float from the buffer.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 121,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "ReadBool",
            "desc": "Read a boolean from the buffer.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 131,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "ReadString",
            "desc": "Read a string from the buffer.\n\n:::info\nThis assumes the string was written using the `BufferWriter:WriteString()`\nmethod, which stores an extra integer to mark the size of the string.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 143,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "ReadStringRaw",
            "desc": "Read a string from the buffer.\n\n:::info\nThis assumes the string was written using the `BufferWriter:WriteStringRaw()`.",
            "params": [
                {
                    "name": "length",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 157,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "ReadDataType",
            "desc": "Read a DataType from the buffer.\n\n```lua\nlocal cframe = reader:ReadDataType(CFrame)\n```",
            "params": [
                {
                    "name": "dataType",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "T\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 172,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "SetCursor",
            "desc": "Sets the position of the cursor.",
            "params": [
                {
                    "name": "position",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 185,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "GetCursor",
            "desc": "Returns the position of the cursor.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 197,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "ResetCursor",
            "desc": "Resets the position of the cursor.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 204,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "GetSize",
            "desc": "Returns the size of the buffer.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 211,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        },
        {
            "name": "GetBuffer",
            "desc": "Returns the `buffer` object.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "buffer\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 218,
                "path": "modules/buffer-util/BufferReader.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "BufferReader",
    "desc": "A BufferReader is an abstraction wrapper for `buffer` objects\nthat provides a convenient way of reading out data from buffers.",
    "source": {
        "line": 13,
        "path": "modules/buffer-util/BufferReader.luau"
    }
}