Garry's Mod Wiki

Revision Difference

Global.CreateNewAddonPreset#552133

<function name="CreateNewAddonPreset" parent="Global" type="libraryfunc"> <description> Creates a new Preset from the given JSON string. </description> <realm>Menu</realm> <file line="426-L433">lua/menu/mainmenu.lua</file> <file line="435-L442">lua/menu/mainmenu.lua</file> <args> <arg name="data" type="string">A JSON string containing all necessary informations. JSON structue should be <page>Structures/Preset</page> </arg> </args> </function> <example> <description>Creating a custom Preset.</description> <code> local preset = { ["enabled"] = {}, ["disabled"] = {}, ["name"] = "Example", ["newAction"] = "" -- do nothing with addons not in the preset. } CreateNewAddonPreset( util.TableToJSON( preset ) ) </code> </example>