Skip to main content

Replica

A class for creating replicated objects.

Replica.Server is used on the server to create and manage replicated objects. Replica.Client is used on the client to receive replicated objects.

Install with wally by adding the following to your wally.toml:

Replica = "dig1t/replica@1.0.4"

Types

Action

interface Action {
typestring--

The type of the action

payloadany--

The data of the action

}

ReplicaTypes

interface ReplicaTypes {
replicaIdstring--

The unique identifier for the replica

classstring--

The class of the replica

keystring--

The key of the data that was changed

valueany--

The new value of the data (Set to nil or leave empty to remove the key)

}

Data

type Data = {[string]any}

Properties

Server

Replica.Server: ReplicaServer

Client

Replica.Client: ReplicaClient
Show raw api
{
    "functions": [],
    "properties": [
        {
            "name": "Server",
            "desc": "",
            "lua_type": "ReplicaServer",
            "source": {
                "line": 33,
                "path": "src/Replica/init.luau"
            }
        },
        {
            "name": "Client",
            "desc": "",
            "lua_type": "ReplicaClient",
            "source": {
                "line": 39,
                "path": "src/Replica/init.luau"
            }
        }
    ],
    "types": [
        {
            "name": "Action",
            "desc": "",
            "fields": [
                {
                    "name": "type",
                    "lua_type": "string",
                    "desc": "The type of the action"
                },
                {
                    "name": "payload",
                    "lua_type": "any",
                    "desc": "The data of the action"
                }
            ],
            "source": {
                "line": 7,
                "path": "src/Replica/ReplicaTypes.luau"
            }
        },
        {
            "name": "ReplicaTypes",
            "desc": "",
            "fields": [
                {
                    "name": "replicaId",
                    "lua_type": "string",
                    "desc": "The unique identifier for the replica"
                },
                {
                    "name": "class",
                    "lua_type": "string",
                    "desc": "The class of the replica"
                },
                {
                    "name": "key",
                    "lua_type": "string",
                    "desc": "The key of the data that was changed"
                },
                {
                    "name": "value",
                    "lua_type": "any",
                    "desc": "The new value of the data (Set to nil or leave empty to remove the key)"
                }
            ],
            "source": {
                "line": 20,
                "path": "src/Replica/ReplicaTypes.luau"
            }
        },
        {
            "name": "Data",
            "desc": "",
            "lua_type": "{ [string]: any }",
            "source": {
                "line": 65,
                "path": "src/Replica/ReplicaTypes.luau"
            }
        }
    ],
    "name": "Replica",
    "desc": "A class for creating replicated objects.\n\n[Replica.Server](/api/ReplicaServer) is used on the server to create and manage replicated objects.\n[Replica.Client](/api/ReplicaClient) is used on the client to receive replicated objects.\n\nInstall with wally by adding the following to your `wally.toml`:\n```toml\nReplica = \"dig1t/replica@1.0.4\"\n```",
    "source": {
        "line": 14,
        "path": "src/Replica/init.luau"
    }
}