OPX//77
opx_infinityprompts

Client

Last updated on

The prompts contract on the client — post, patch and take down groups of key-strip rows.

local prompts = OPX.Api.Get('prompts')

From client code inside opx_infinity. Each function answers a Result. None yields.

owner is your module name (1–64 characters of letters, digits, _ : - .). It is a label for grouping and expiry, not a security boundary. If it is a module of this runtime or a running resource, its groups are dropped when it stops.

Show

Puts a group up, or replaces the owner's group with that id in place. The spec is validated whole or refused.

prompts.Show(owner, id, spec)

Parameters

  • owner: string
  • id: string — the group id
  • spec: table — see Spec format

Returns

  • Result — { id, replaced, rows }
Example
prompts.Show('mymodule', 'door', {
  title = 'DOOR',
  rows = { { id = 'open', label = 'Open', keys = { action = 'mymodule.open', fallback = 'E' } } },
})

Update

Patches a held group. Absent fields keep their value.

prompts.Update(owner, id, patch)

Parameters

  • owner: string
  • id: string
  • patch: table
    • title, priority, rows, or values = { [rowId] = value } (false clears a value). rows and values cannot be combined.

Returns

  • Result — { id }; error prompts.notFound
Example
prompts.Update('mymodule', 'door', { values = { open = 'LOCKED' } })

Hide

Takes one group down. An unknown id answers removed = false, not an error.

prompts.Hide(owner, id)

Parameters

  • owner: string
  • id: string

Returns

  • Result — { removed }

HideAll

Takes every group of the owner down.

prompts.HideAll(owner)

Parameters

  • owner: string

Returns

  • Result — { removed }

List

The owner's group ids (sorted), and whether any of them was in the last drawn strip.

prompts.List(owner)

Parameters

  • owner: string

Returns

  • Result — { prompts, count, visible }

Spec format

FieldTypeRule
titlestringOptional, max 32 bytes, no control characters. false or '' = no title.
priorityintegerOptional, default 0, -100..100. Higher draws first; at equal priority the newest group wins.
rowstableRequired, 1–8 rows.

Row fields:

FieldTypeRule
labelstringRequired, max 48 bytes. Your own text (translate it yourself).
keysstring, table or listRequired. A literal string is split on spaces ('W A S D' = four caps). { action = 'mapping.id', fallback = 'E' } is one cap drawn with the player's binding of that key mapping. A list mixes both. Max 6 caps per row.
idstringOptional, max 32 characters, unique in the group. Needed to patch with values.
valuestring or numberOptional, max 24 bytes. Drawn beside the label.
holdbooleanOptional. Sent to the page, but the shipped page no longer draws a hold tag.
combobooleanOptional. The page joins the caps (one combination, not alternatives).
dimbooleanOptional. The page draws the row dimmed.

On this page