Skip to main content

Buffer

The primary class for this module. It is used to handle all forms of buffer serialization and deserialization.

Functions

new

Buffer.new(
optionsBufferOptions--

Configuration options for class initialization

) → Buffer--

Returns an instance of the Buffer class.

Create an instance of the Buffer class.

Serialize

Buffer:Serialize(
data{any}--

The data you want to serialize.

) → buffer

This function takes an array of data and serializes it according to the supplied template.

Deserialize

Buffer:Deserialize() → {any}

This function outputs a deserialized table corresponding to the contents of the current buffer.

Write

Buffer:Write(
memorySizenumber,--

The amount of memory (bytes) being written.

dataTypestring,--

The data type being inscribed.

valuenumber--

The value being inscribed.

) → Buffer

This function is utilized internally. It is used to write a specific data type into a buffer, and increment the pointer accordingly.

Read

Buffer:Read(
memorySizenumber,--

The amount of memory being read.

dataTypestring--

The data type being read.

) → any

This function is utilized internally. It is used to read a specific data type from the buffer, and increment the pointer accordingly.

IncrementPointer

Buffer:IncrementPointer(
amountnumber--

How much to increment the pointer by.

) → Buffer

This function is used internally. It is used to increment the pointer.

SetTemplate

Buffer:SetTemplate(
template{string}--

The new template.

) → Buffer

This function allows you to specify the serialization / deserialization template.

MakeNewBuffer

Buffer:MakeNewBuffer() → Buffer

This function creates a new buffer with size relative to the current template.

ImportBuffer

Buffer:ImportBuffer(
bufferbuffer--

The buffer being imported.

) → Buffer

This function imports an external buffer, and begins using it.

Destroy

Buffer:Destroy() → nil

This function cleans up the Buffer instance.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Create an instance of the Buffer class.",
            "params": [
                {
                    "name": "options",
                    "desc": "Configuration options for class initialization",
                    "lua_type": "BufferOptions"
                }
            ],
            "returns": [
                {
                    "desc": "Returns an instance of the Buffer class.",
                    "lua_type": "Buffer"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 92,
                "path": "src/Commons/Buffer/init.luau"
            }
        },
        {
            "name": "Serialize",
            "desc": "This function takes an array of data and serializes it according to the supplied template.",
            "params": [
                {
                    "name": "data",
                    "desc": "The data you want to serialize.",
                    "lua_type": "{any}"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "buffer"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 123,
                "path": "src/Commons/Buffer/init.luau"
            }
        },
        {
            "name": "Deserialize",
            "desc": "This function outputs a deserialized table corresponding to the contents of the current buffer.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{any}"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 141,
                "path": "src/Commons/Buffer/init.luau"
            }
        },
        {
            "name": "Write",
            "desc": "This function is utilized internally.  It is used to write a specific data type into a buffer, and increment the pointer accordingly.",
            "params": [
                {
                    "name": "memorySize",
                    "desc": "The amount of memory (bytes) being written.",
                    "lua_type": "number"
                },
                {
                    "name": "dataType",
                    "desc": "The data type being inscribed.",
                    "lua_type": "string"
                },
                {
                    "name": "value",
                    "desc": "The value being inscribed.",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Buffer"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 160,
                "path": "src/Commons/Buffer/init.luau"
            }
        },
        {
            "name": "Read",
            "desc": "This function is utilized internally.  It is used to read a specific data type from the buffer, and increment the pointer accordingly.",
            "params": [
                {
                    "name": "memorySize",
                    "desc": "The amount of memory being read.",
                    "lua_type": "number"
                },
                {
                    "name": "dataType",
                    "desc": "The data type being read.",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 175,
                "path": "src/Commons/Buffer/init.luau"
            }
        },
        {
            "name": "IncrementPointer",
            "desc": "This function is used internally.  It is used to increment the pointer.",
            "params": [
                {
                    "name": "amount",
                    "desc": "How much to increment the pointer by.",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Buffer"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 189,
                "path": "src/Commons/Buffer/init.luau"
            }
        },
        {
            "name": "SetTemplate",
            "desc": "This function allows you to specify the serialization / deserialization template.",
            "params": [
                {
                    "name": "template",
                    "desc": "The new template.",
                    "lua_type": "{string}"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Buffer"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 202,
                "path": "src/Commons/Buffer/init.luau"
            }
        },
        {
            "name": "MakeNewBuffer",
            "desc": "This function creates a new buffer with size relative to the current template.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Buffer"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 214,
                "path": "src/Commons/Buffer/init.luau"
            }
        },
        {
            "name": "ImportBuffer",
            "desc": "This function imports an external buffer, and begins using it.",
            "params": [
                {
                    "name": "buffer",
                    "desc": "The buffer being imported.",
                    "lua_type": "buffer"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Buffer"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 227,
                "path": "src/Commons/Buffer/init.luau"
            }
        },
        {
            "name": "Destroy",
            "desc": "This function cleans up the Buffer instance.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "nil"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 239,
                "path": "src/Commons/Buffer/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Buffer",
    "desc": "The primary class for this module.  It is used to handle all forms of buffer serialization and deserialization.",
    "source": {
        "line": 68,
        "path": "src/Commons/Buffer/init.luau"
    }
}