util/AddNetworkString

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(maybe better wording required)
Line 5: Line 5:
 
If the passed string already exists, nothing will happen and the ID of the existing item will be returned.
 
If the passed string already exists, nothing will happen and the ID of the existing item will be returned.
  
{{Note|Do not put this function call into any other functions. Preferable place for this function is at the top of a serverside lua file.}}
+
{{Note|Do not put this function call into any other functions. Preferable place for this function is in the same serverside lua file the string is used with {{Lib|net}} but at the top.}}
 
{{Note|The string table used for this function does not interfere with the engine string tables and has 2048 slots.}}
 
{{Note|The string table used for this function does not interfere with the engine string tables and has 2048 slots.}}
 
|Realm=Server
 
|Realm=Server

Revision as of 06:46, 7 May 2019

 util.AddNetworkString( )

Description

Adds the specified string to a string table, which will cache it and network it to all clients automatically.
Whenever you want to create a net message with net.Start, you must add the name of that message as a networked string via this function.

If the passed string already exists, nothing will happen and the ID of the existing item will be returned.

NOTE

Do not put this function call into any other functions. Preferable place for this function is in the same serverside lua file the string is used with net library but at the top.

NOTE

The string table used for this function does not interfere with the engine string tables and has 2048 slots.

Arguments

string str

Adds the specified string to the string table.

Returns

number

The id of the string that was added to the string table.

Same as calling util.NetworkStringToID.
Personal tools
Navigation