Garry's Mod Wiki

cookie

🍪 Cookie - Library

Functions to persist data on a user's computer.

The data will be read / written to / from a database
corresponding to the realm the library was used in.

Realm Database File
Server garrysmod/sv.db
Client garrysmod/cl.db
Menu garrysmod/mn.db

Methods

cookie.Delete( string key )
Removes any cookie with the given name. Does nothing if the cookie doesn't exist.
number cookie.GetNumber( string name, any default = nil )
Gets the value of a cookie on the client as a number.
string cookie.GetString( string name, any default = nil )
Gets the value of a cookie on the client as a string.
cookie.Set( string key, string value )
Creates / updates a cookie in the Database.