netvars library
Summary
Functions
AreEqual(old, new)server
Returns whether two values are equal, comparing tables by content.
GetNetVar(key, default)shared
Returns the value of a global networked variable.
Sets a global networked variable and sends it to clients.
Functions
Returns whether two values are equal, comparing tables by content.
Parameters
- old Any The first value
- new Any The second value
Returns
- Boolean Whether the values are equal
- String
'table'when both values are tables
On the server
Returns the value of a global networked variable.
Parameters
- key String Name of the variable
- default Any optional, defaults to
nilValue to return if the variable isnilorfalse
Returns
- Any The value, or
default
See also
On the client
Returns the value of a global networked variable received from the server.
Parameters
- key String Name of the variable
- default Any optional, defaults to
nilValue to return if the variable isnilorfalse
Returns
- Any The value, or
default
Defined in
netvars.SetNetVar(key, value, receiver)
server gamemodes/catwork/gamemode/core/libraries/sv_netvars.lua:67Sets a global networked variable and sends it to clients.
Does nothing if a non-table value is unchanged, or if the value contains a
function (which prints an error). Players who join later receive it through
Player:SyncVars.
Parameters
- key String Name of the variable
- value Any The new value; must not be or contain a function
- receiver Player optional, defaults to
nilA player or list of players to send the change to;nilsends it to everyone