Difference between revisions of "ScriptHook: Script Config"

From Nomad DB
(Created page with "{{Page_MDE}}{{Page_WDL}} You can store persistent data using the Script Config system. It allows reading and saving data to a ''user-options.json'' file, which is located in y...")
 
(No difference)

Latest revision as of 11:40, 15 April 2021

You can store persistent data using the Script Config system. It allows reading and saving data to a user-options.json file, which is located in your ScriptHook: Script's folder.

Supported Types

  • boolean
  • number (float, integer, unsigned)
  • string

Although saved as a JSON file, this system does not support nested objects nor arrays (yet).

Lua

  • Script():SetConfigOption(name)
  • Script():SetConfigOption(name, val)

Example

local script = Script()
script:SetConfigOption("hello", "world")
print(script:GetConfigOption("hello")) -- prints "world"

Related Pages