Garry's Mod Wiki

Revision Difference

cookie.Set#561747

<function name="Set" parent="cookie" type="libraryfunc">⤶ # 🍪 Cookie - Set⤶ ⤶ <function name="Set" parent="cookie" type="libraryfunc">⤶ ⤶ <file line="116-L121">lua/includes/modules/cookie.lua</file>⤶ <realm>Shared and Menu</realm>⤶ ⤶ <description> Sets the value of a cookie, which is saved automatically by the <page>sql</page>. ⤶ These are stored in the *.db files - cl.db for clients, mn.db for menu state and sv.db for servers. </description>⤶ <realm>Shared and Menu</realm>⤶ <file line="116-L121">lua/includes/modules/cookie.lua</file>⤶ ⤶ Creates / updates a cookie in the <page text = 'Database'>cookie</page>. </description>⤶ <args> <arg name="key" type="string">The name of the cookie that you want to set.</arg>⤶ <arg name="value" type="string">Value to store in the cookie.</arg>⤶ </args>⤶ </function>⤶ <arg name="key" type="string">⤶ ⤶ The name of the cookie. </arg>⤶ <arg name="value" type="string">⤶ ⤶ The data stored in the cookie.⤶ ⤶ </arg>⤶ ⤶ </args>⤶ ⤶ </function>⤶ ⤶ ⤶ <br/>⤶ ⤶ ---⤶ ⤶ <br/>⤶ ⤶ <example>⤶ ⤶ <description>⤶ ⤶ Sets & prints out a cookie's value.⤶ ⤶ </description>⤶ ⤶ <code>⤶ ⤶ cookie.Set('My-Cookie','Hello World')⤶ ⤶ print('Set My-Cookie')⤶ ⤶ print('My-Cookie:',cookie.GetString('My-Cookie'))⤶ ⤶ </code>⤶ ⤶ ⤶ <output>⤶ ⤶ ```⤶ Set My-Cookie⤶ My-Cookie: Hello World⤶ ```⤶ ⤶ </output>⤶ ⤶ </example>