ScriptHook: Script Config

From Nomad DB
Revision as of 11:40, 15 April 2021 by Administrator (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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