OPX//77
CreatorsServer exports

GetMetadata

Last updated on

Reads your resource's own metadata on a character.

local res = exports.opx_infinity:GetMetadata(target, key)

Scope read · sync for a loaded player · must be awaited when target is a citizen id.

Parameters

  • target: number | string — a connected player id, or a citizen id (a character nobody is playing)

  • key?: string

  • Each resource has its own space: your key is stored as ext.<your resource>.<key>, so you cannot reach OPX's keys or another resource's.

  • A citizen id reads the stored row when the character is not online (and memory when it is).

  • key: one segment, 1–48 characters, letters, digits, _ and - (no dot).

Returns

  • any — the value of your key, or with no key every key you stored as { [key] = value }

Errors

  • export.badArgument, error.notLoggedIn, character.notFound, export.mustAwait
Example
local res = exports.opx_infinity:GetMetadata(source, 'deliveries')
local done = res.ok and res.value or 0

On this page

No Headings