Skip to main content
Server reads are asynchronous: they resolve from memory when the configuration is current, and fetch when it is not. Reads see every flag by default, because the server is the trusted side. Pass 'shared' as the last argument to read as a client would.

Exports

Checks whether a boolean flag is on.
Parameters
  • key: string — The flag’s key
  • fallback: boolean — Returned when the flag is not a readable boolean flag (optional, false by default)
  • runtime: 'server'|'shared' — The runtime reading the flag (optional, 'server' by default)
Returns
  • enabled: boolean — Whether the flag is on
A missing flag, one holding a non-boolean value, or one this runtime may not read all return the fallback — so archiving a flag in the dashboard can never break a running server.
Reads a flag’s value, whatever its type.
Parameters
  • key: string — The flag’s key
  • fallback: any — Returned when the flag is missing or unreadable (optional)
  • runtime: 'server'|'shared' — The runtime reading the flag (optional, 'server' by default)
Returns
  • value: any — The flag’s value, or the fallback
Reads a flag whole — its key, type, value and runtime.
Parameters
  • key: string — The flag’s key
  • runtime: 'server'|'shared' — The runtime reading the flag (optional, 'server' by default)
Returns
  • flag: table? — A table with key, type, value and runtime, or nil if the flag does not exist or this runtime may not read it
Reads every flag this runtime may see, keyed by flag key.
Parameters
  • runtime: 'server'|'shared' — The runtime reading the flags (optional, 'server' by default)
Returns
  • values: table — The flag values, keyed by flag key
Reads the values held right now, without contacting the API.
Parameters
  • runtime: 'server'|'shared' — The runtime reading the flags (optional, 'server' by default)
Returns
  • values: table — The flag values held in memory, keyed by flag key
Unlike the other server reads, this one returns immediately rather than a promise. It is for callers that cannot wait — what it returns is whatever the last fetch or the stored cache left behind.
Refetches the flags now, ignoring both the cache window and the polling schedule.
Returns
  • values: table — The flags the server now holds, server-only ones included
Throws
  • If the API request fails, or if feature flags are disabled in the configuration.
This restarts the cache window like any other fetch, so the poll that follows an explicit refresh does not immediately spend another request.
Whether there are values to read.
Returns
  • ready: boolean
False only before the first fetch answers with no cached snapshot to fall back on.
Whether the values being served came from the last-known cache rather than from a fetch.
Returns
  • stale: boolean
True on a restart until the first read or poll answers, and for as long as the API stays unreachable after that.

Events

nocloud.flags.updated

Fired locally on the server when a fetch finds a change. Values never cross the network as an event — this is a server-side listener, so it sees the whole snapshot including server-only flags.
Handler parameters
  • values: table — Every flag the server holds, keyed by flag key
  • changes: table[] — What differs from the previous snapshot
Change entry
A change nobody reads is a change nothing goes and finds. If this handler is the only thing watching your flags, set flags.polling.enabled to true in the configuration — otherwise polling runs only while a client is reading.
A runtime flip counts as a change as much as a value does — it decides whether players still see the flag at all.

Lua Library

For a cleaner API, include the server Lua library in your fxmanifest.lua:
Usage
The library ships full LuaLS annotations, so Cloud.flags autocompletes with parameter and return types in any editor with the Lua Language Server.