Garry's Mod Wiki

util.AddNetworkString

number util.AddNetworkString( string str )

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.

Each unique network name needs to be pooled once - do not put this function call into any other functions if you're using a constant string. Preferable place for this function is in a serverside lua file, or in a shared file with the net.Receive function.
The string table used for this function does not interfere with the engine string tables and has 2048 slots.

Arguments

1 string str
Adds the specified string to the string table.

Returns

1 number
The id of the string that was added to the string table.
Same as calling util.NetworkStringToID.

Page Links


Special Pages


Wikis

?

Render Time: 33ms

DB GetPage 4
Generate Html 4
SaveChanges (1) 11
Render Body 0
Render Sidebar 12