Skip to content

Settings reference ​

Everything npAdmin.settings(def) accepts. np_admin validates every definition when it's registered and every value when staff save it, on the server. A field that doesn't validate is skipped and doesn't break the others.

Definition ​

lua
npAdmin.settings({
  label = 'My resource',        -- name on the Resource settings page (default: resource name)
  icon = 'box-open',            -- Font Awesome icon name, without "fa-"
  tint = 'orange',              -- tile colour, see below
  description = 'Short text shown above the form',
  version = '1.2.0',            -- default: the manifest's version
  target = Config,              -- the table the keys point into (default: Config)
  categories = { 'General', 'Limits' },   -- tab order; categories used by fields are appended
  fields = { … },
})
Property Limits
label 64 characters
tint neutral red orange rust pink olive lilac green blue aqua brand
categories 32 categories, 64 characters each
fields 1000 fields; duplicate keys are skipped

Field properties ​

Property Type
key string Required. Dotted path below target: 'Payout.max'. Letters, digits, _, . and -, at most 128 characters. A segment of digits addresses an array slot ('Shops.1.price')
type string One of the types below. Default text
label string Default: the key
help string Hint under the field (description works too)
category string Tab the field appears in
apply 'live' 'reload' 'restart' When a change takes effect. Default live. See Integration guide
scope 'shared' 'server' shared replicates the override to clients. Default server; secrets are always server
permission string Extra node needed to edit this field; others see it read-only
min max step number Numbers and sliders. max is also the entry limit of a list
unit string Shown after the value: 's', '%', '$'
options array select / multiselect. Values ({ 'a', 'b' }) or { value =, label = } tables. Up to 200
item 'number' list of numbers instead of strings
pattern string Lua pattern checked on the server for text / textarea / secret
maxLength integer Text length limit
required boolean Text can't be empty
placeholder string
convar string secret only: read this convar while no override is stored

Field types ​

Type Value Validation
toggle boolean
number number min, max, step
slider number Like number, shown as a slider
select one option Must be one of options. The type counts too: 1 isn't '1'
multiselect array of options Duplicates are removed
text string 512 characters, or maxLength. pattern, required
textarea string 4096 characters, or maxLength. Keeps line breaks
color '#rrggbb'
list array of strings (or numbers with item = 'number') 200 entries, or max. Strings are cut at 256 characters
keybind key name Letters, digits, _ + - and spaces, 32 characters
coords { x, y, z, w? } Within ±100000. Overrides arrive as a table, not a vector
secret string 1024 characters. Never sent to clients, masked without np_admin.settings.secrets
json any plain table or value 16 KB, no functions, nested at most 8 levels

Reading values ​

lua
Config.Payout.max                        -- the override is written into the table
npAdmin.get('Payout.max')                -- the same, by key
npAdmin.onChange('Payout.max', function(value, old) … end)
npAdmin.onChange('*', function(value, old, key) … end)

Resetting a field restores the default from your config. If that default is nil, the key becomes nil again.

Permission nodes ​

Node
np_admin.settings.view See the Resource settings page
np_admin.settings.edit Save changes
np_admin.settings.secrets See and edit secret fields

view and edit can be limited to one resource. See Permissions.