Open77.kvp

Runs inside the game process. Reads and presentation are local; anything that changes shared state has to go through the server.

client runtime11 functionsMarkdown

clear

CLIENT

Open77.kvp.clear([prefix])

Clears this resource's keys matching a prefix.

Atomically removes every key matching an optional prefix from the calling resource's current-server store and returns the removal count. An empty prefix clears only that resource namespace.

Parameters

  • prefixstringoptional

Returns

  • removed count, or nil
  • reason

Registered in ResourceHost.cpp as LuaKvpClear (line 6661).

Open77.kvp.compareAndSet(key, expected, replacement)

Atomically changes a key when its typed value matches.

Atomically replaces a key only when its typed value exactly matches the expected value. Nil expected means the key must be absent; nil replacement deletes after a successful comparison.

Parameters

  • keystringrequired
  • expectedanyrequired
  • replacementanyrequired

Returns

  • boolean
  • reason on storage failure

Registered in ResourceHost.cpp as LuaKvpCas (line 6664).

delete

CLIENT

Open77.kvp.delete(key)

Deletes one persistent key.

Atomically deletes one key from the current resource store and returns whether it existed. Deleting a missing key succeeds with false.

Parameters

  • keystringrequired

Returns

  • true when removed, false when absent
  • reason on storage failure

Registered in ResourceHost.cpp as LuaKvpDelete (line 6658).

find

CLIENT

Open77.kvp.find([prefix], [limit])

Finds typed entries by sorted key prefix.

Performs a sorted prefix search in the current resource store and returns bounded {key, value, type} records. The default result limit is 256 and the hard limit is 4096.

Parameters

  • prefixstringoptional
  • limitintegeroptionaldefault 256

Returns

  • array of { key, value, type }, or nil
  • reason

Registered in ResourceHost.cpp as LuaKvpFind (line 6659).

get

CLIENT

Open77.kvp.get(key, [default])

Reads one typed persistent value.

Reads a typed value from the current connection-address and resource namespace. Missing keys return the optional default (or nil) and are distinct from storage errors, which return nil, reason.

Parameters

  • keystringrequired
  • defaultanyoptional

Returns

  • stored value, default or nil
  • reason on storage failure

Registered in ResourceHost.cpp as LuaKvpGet (line 6656).

has

CLIENT

Open77.kvp.has(key)

Checks whether a persistent key exists.

Checks whether a key exists in the calling resource's current-server store without exposing its value or any other resource namespace.

Parameters

  • keystringrequired

Returns

  • boolean
  • reason on storage failure

Registered in ResourceHost.cpp as LuaKvpHas (line 6657).

increment

CLIENT

Open77.kvp.increment(key, [delta])

Atomically increments a numeric key.

Atomically creates or increments a numeric key. Integer arithmetic remains 64-bit and rejects overflow; mixed/floating arithmetic rejects non-finite results.

Parameters

  • keystringrequired
  • deltainteger|numberoptionaldefault 1

Returns

  • new numeric value, or nil
  • reason

Registered in ResourceHost.cpp as LuaKvpIncrement (line 6662).

keys

CLIENT

Open77.kvp.keys([prefix], [limit])

Lists sorted keys matching a prefix.

Returns only the sorted keys matching an optional prefix in the current resource store. It is a bounded index query and cannot enumerate another package or connection address.

Parameters

  • prefixstringoptional
  • limitintegeroptionaldefault 256

Returns

  • string array, or nil
  • reason

Registered in ResourceHost.cpp as LuaKvpFind (line 6660).

set

CLIENT

Open77.kvp.set(key, value)

Persists one typed value for this server address and resource.

Atomically persists a string, signed integer, finite number or boolean under the current connection address and resource. Keys/values and the 1 MiB resource quota are validated before the old file is replaced.

Parameters

  • keystringrequired
  • valuestring|integer|number|booleanrequired

Returns

  • true on success, otherwise false
  • reason

Registered in ResourceHost.cpp as LuaKvpSet (line 6655).

Open77.kvp.setIfAbsent(key, value)

Stores a value only when its key is missing.

Redis-style SETNX for the current resource namespace: atomically stores the typed value only when the key is missing and reports whether insertion occurred.

Parameters

  • keystringrequired
  • valuestring|integer|number|booleanrequired

Returns

  • boolean
  • reason on storage failure

Registered in ResourceHost.cpp as LuaKvpSetNx (line 6663).

stats

CLIENT

Open77.kvp.stats()

Returns this resource store's usage and quotas.

Returns this resource's entry/byte usage and enforced quotas together with the active address/resource scope. It exposes no keys or usage belonging to other resources.

Returns

  • table, or nil
  • reason

Registered in ResourceHost.cpp as LuaKvpStats (line 6665).

For agents and LLMs: this page as Markdown · llms.txt · llms-full.txt