KeyValueStore
A place to save small values under names you choose, which you get from data.store.
Fields
namestring
A place to save small values under names you choose, which you get from data.store.
Gives back the value that is saved in the store for a key.
local motd = settings:get("motd")Use it forloading the welcome message that each server shows when it starts.
keyThe key.Saves a value for a key, and saving nil removes the key.
settings:set("motd", "Welcome!")Use it forchanging the welcome message that every server of your game reads.
keyThe key.valueThe new value, at most 64 KB as JSON. Nil removes the key.Gives a key's value to a function you write, and saves whatever it returns.
settings:update("visits", function(value) return (value or 0) + 1 end)Use it forcounting total visits safely while many servers add to the same number at once.
keyThe key.transformGets the value and returns the new one, not nil. It can run more than once, and must not yield.Deletes the saved value for a key from the store.
settings:remove("motd")Use it forclearing an event message once the event is over, so players stop seeing it.
keyThe key.