Server
Server.
Using Cosmoble
In order to begin using Cosmoble you will first need to fetch it, you can do this using require()
.
Getting a Cosmoble's Data
When you want to get the Cosmoble data via server, use the get
and provide a Cosmoble name in order to get it, if data exists it will return a Cosmoble containing it.
Creating a Cosmoble
Creates and returns a new Cosmoble with the given arguments. If a table with the specified name already exists, the existing table will be returned.
name
- string
: The name of the Cosmoble you are trying to make.
tbl
- table
: The initial table you want to turn into a Cosmoble.
player
- player
: The player who will be able to use the table ( optional )
Cosmoble Methods
<CosmobleTable>
.clear() - Sets all keys in the given table to nil.<CosmobleTable>
.insert(value: any) - Appends the provided value to the end of the array.<CosmobleTable>
.remove(pos: number) - Removes the specified element from the array.<CosmobleTable>
.find(needle: any, init: number) - Returns the index of the first occurrence of needle within haystack starting from init.<CosmobleTable>
.concat(sep: string, i: number, j: number) - Returns the given range of table elements as a string where each element is separated by the given separator.<CosmobleTable>
.clone() - Returns a shallow copy of the provided table.<CosmobleTable>.move(a:
number, b: number, t: number, dst: {}) - Copies the specified range of elements from one table to another.<CosmobleTable>
.sort(comp: function) - Sorts table elements using the provided comparison function.<CosmobleTable>
.original() - Returns the raw table which is being meta'd.
Connecting to a Cosmoble
When connecting to a Cosmoble via server, use the connectCosmoble
function with the arguments below.
cosmobleName
- string
: The name of the Cosmoble
table to connect to.
theConnection
- string
: A unique name for the connection.
function(key, value)
- a callback function
that will be called whenever a change is detected in your game data
When connecting to nested tables connected to player data, the cosmobleName will be set to the player.UserId_auto_indexTableName & when not a player data it's auto_indexTableName
Disconnecting from a Cosmoble
When you are finished using a Cosmoble, you should disconnect from it using the disconnectCosmoble
function with the arguments below, this will stop calling your connected function.
cosmobleName
- string
: The name of the Cosmoble table that you want to disconnect from.
connectionName
- string
: The unique name of the connection that you want to disconnect from.
Destroying a Cosmoble
Destroys the table with the specified name, if it exists.
name
- string
: The name of the Cosmoble you are trying to destroy.
Last updated