Show raw api
{
"functions": [
{
"name": "newClassToken",
"desc": "Returns a ClassToken Symbol that is used for identifying the TSR Class.\nWe use unique symbols instead of strings to prevent accidental collisions.\n\n:::warning\nThis may only be called once per unique string. The returned symbol should\nbe used repeatedly instead of calling this function again. Calling this\nfunction again with the same string will result in an error.\n:::",
"params": [
{
"name": "tokenName",
"desc": "",
"lua_type": "string"
}
],
"returns": [
{
"desc": "",
"lua_type": "ClassToken\n"
}
],
"function_type": "static",
"source": {
"line": 293,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "new",
"desc": "Creates a new TableServerReplicator instance.\nThe config must be given a TableManager instance and a ClassToken Symbol.\n\nA list of replication targets can be provided to specify which\nplayers the TSR should replicate to immediately. If no replication targets\nare specified, the TSR will not replicate to any players.\n\nYou can specify a Parent TSR instead of giving ReplicationTargets and it will\ninherit the replication targets of the top level TSR.\n\nOptionally, a list of tags can be provided to help identify the TSR. The\ntags list will become immutable internally after the TSR is created.\n\nEXAMPLE:\n```lua\n-- Some Server Script\nlocal token = TableServerReplicator.newClassToken(\"PlayerData\")\n\nPlayers.PlayerAdded:Connect(function(player)\n local manager = TableManager.new({\n Money = math.random(1, 100);\n })\n\n local replicator = TableServerReplicator.new({\n TableManager = manager,\n ClassToken = token,\n ReplicationTargets = \"All\",\n Tags = {UserId = player.UserId},\n })\nend)\n```\n```lua\n-- Some Client Script\nTableClientReplicator.listenToNewReplicator(\"PlayerData\", function(replicator)\n print(\"New PlayerData TSR: \", replicator:GetTag(\"UserId\"))\n print(\"Money: \", replicator:GetTableManager():Get(\"Money\"))\nend)\n```\n\n:::warning Top Level Replicators\nA replicator must be given either a Parent Replicator or a list of ReplicationTargets.\nIf both are given then it will produce an error.\n\nIf you give ReplicationTargets then that Replicator will be known as TopLevel. Only\nTopLevel Replicators can have their ReplicationTargets manually changed.\n\nIf a Parent Replicator is given, the Child Replicator will inherit the replication targets of the Ancestor\nTopLevel Replicator.\n:::",
"params": [
{
"name": "config",
"desc": "",
"lua_type": "{\n ClassToken: ClassToken,\n TableManager: TableManager,\n ReplicationTargets: ReplicationTargets?,\n Parent: TableServerReplicator?,\n Tags: {[string]: any}?,\n Client: {[string]: any}?,\n}"
}
],
"returns": [],
"function_type": "static",
"source": {
"line": 357,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "Destroy",
"desc": "Destroys the Replicator on both the Server and any replicated Clients",
"params": [],
"returns": [],
"function_type": "method",
"source": {
"line": 479,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "_InitListeners",
"desc": "",
"params": [],
"returns": [],
"function_type": "method",
"private": true,
"source": {
"line": 491,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "_GeneratePacket",
"desc": "Serializes the TSR into a packet that can be sent to the client.",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "TRPacket\n"
}
],
"function_type": "method",
"private": true,
"source": {
"line": 536,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "_StopReplicatingToTargets",
"desc": "Tells the client to stop replicating to the targets.",
"params": [
{
"name": "targets",
"desc": "",
"lua_type": "CanBeArray<Player>"
}
],
"returns": [],
"function_type": "method",
"private": true,
"source": {
"line": 549,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "_StartReplicatingToTargets",
"desc": "Tries to immediately replicate to the targets if not replicated already.",
"params": [
{
"name": "targets",
"desc": "",
"lua_type": "CanBeArray<Player>"
}
],
"returns": [],
"function_type": "method",
"private": true,
"source": {
"line": 570,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "RegisterRemoteSignal",
"desc": "Registers a new reliable remote signal.",
"params": [
{
"name": "signalName",
"desc": "",
"lua_type": "string"
}
],
"returns": [],
"function_type": "method",
"private": true,
"unreleased": true,
"source": {
"line": 606,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "RegisterRemoteUnreliableSignal",
"desc": "Registers a new unreliable remote signal.",
"params": [
{
"name": "signalName",
"desc": "",
"lua_type": "string"
}
],
"returns": [],
"function_type": "method",
"private": true,
"unreleased": true,
"source": {
"line": 616,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "GetRemoteSignal",
"desc": "Gets an existing RemoteSignal by name. Can be either reliable or unreliable.",
"params": [
{
"name": "signalName",
"desc": "",
"lua_type": "string"
}
],
"returns": [
{
"desc": "",
"lua_type": "ServerCustomRemote\n"
}
],
"function_type": "method",
"private": true,
"unreleased": true,
"source": {
"line": 626,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "RegisterRemoteFunction",
"desc": " ",
"params": [
{
"name": "fnName",
"desc": "",
"lua_type": "string"
},
{
"name": "fn",
"desc": "",
"lua_type": "(...any) -> ...any"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 635,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "IsReplicatingToAll",
"desc": "Returns whether or not this TSR is replicating to all current and future players.",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "boolean\n"
}
],
"function_type": "method",
"source": {
"line": 647,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "IsReplicationTarget",
"desc": "Checks whether the player is a valid target for replication.\nNot whether the player is currently being replicated to.",
"params": [
{
"name": "player",
"desc": "",
"lua_type": "Player"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean\n"
}
],
"function_type": "method",
"source": {
"line": 655,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "GetReplicationTargets",
"desc": "Gets the list of Players that this Replicator is attempting to replicate to.",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "{Player}\n"
}
],
"function_type": "method",
"source": {
"line": 668,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "GetActiveReplicationTargets",
"desc": "Gets the list of Players that this Replicator is *currently* replicating to.\nThis is different from GetReplicationTargets as it does not include pending replication targets.",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "{Player}\n"
}
],
"function_type": "method",
"source": {
"line": 685,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "Set",
"desc": "Shortcut to set a value in the TableManager.",
"params": [
{
"name": "...",
"desc": "",
"lua_type": "any"
}
],
"returns": [],
"function_type": "method",
"private": true,
"source": {
"line": 701,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "SetParent",
"desc": "Sets the Parent of this TSR to the given TSR.",
"params": [
{
"name": "newParent",
"desc": "",
"lua_type": "TableServerReplicator"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 708,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "DestroyFor",
"desc": "Removes a player or list of players from the replication targets.",
"params": [
{
"name": "targets",
"desc": "",
"lua_type": "ReplicationTargets"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 830,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "ReplicateFor",
"desc": "Adds a player or list of players to the replication targets.",
"params": [
{
"name": "targets",
"desc": "",
"lua_type": "ReplicationTargets"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 864,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "SetReplicationTargets",
"desc": "Overwrites the current replication targets with the new targets.",
"params": [
{
"name": "targets",
"desc": "",
"lua_type": "ReplicationTargets"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 898,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
}
],
"properties": [
{
"name": "AddedActivePlayer",
"desc": "A signal that fires whenever a player starts being replicated to.\nThis happens when their client requests the current data from the server.",
"lua_type": "Signal<Player>",
"source": {
"line": 176,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "RemovedActivePlayer",
"desc": "A signal that fires whenever a player stops being replicated to.\nThis happens when the player leaves the game.",
"lua_type": "Signal<Player>",
"private": true,
"source": {
"line": 185,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "All",
"desc": "A TSR that replicates to all current and future players.\nUsed as a global parent for child TSRs that need a home and should\nbe replicated to all current and future players. Do not modify\nanything about this TSR, only use it as a Parent.",
"lua_type": "TableServerReplicator",
"source": {
"line": 957,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "None",
"desc": "A TSR that doesnt replicate to anyone.\nUsed as a global parent for child TSRs that shouldnt be replicated.\nDo not modify anything about this TSR, only use it as a Parent.",
"lua_type": "TableServerReplicator",
"source": {
"line": 970,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
}
],
"types": [
{
"name": "ReplicationTargets",
"desc": "The Player(s) that the TSR should replicate to.\nIf \"All\" is given then the TSR will replicate to all current and future players.",
"lua_type": "\"All\" | Player | {Player}",
"source": {
"line": 84,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
},
{
"name": "ClassToken",
"desc": "A unique symbol that identifies the TSR Class.\nThis is used to identify the TSR Class when it is replicated to the client.\nUse `.newClassToken` to generate an object of this type. Do NOT manually create\nthe table.",
"lua_type": "{Name: string}",
"source": {
"line": 94,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
}
],
"name": "TableServerReplicator",
"desc": "TableServerReplicator handles replication of a given TableManager object to the client.\nThis system very closely follows the idea behind ReplicaService and should be familiar to\nanyone who has used it.\n\nInherits from BaseTableReplicator. See BaseTableReplicator for inherited methods.",
"realm": [
"Server"
],
"source": {
"line": 13,
"path": "src/tablereplicator/src/Server/TableServerReplicator.lua"
}
}