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 }
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:
tabletitle,priority,rows, orvalues={ [rowId] = value }(falseclears a value).rowsandvaluescannot be combined.
Returns
Result—{ id }; errorprompts.notFound
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
| Field | Type | Rule |
|---|---|---|
title | string | Optional, max 32 bytes, no control characters. false or '' = no title. |
priority | integer | Optional, default 0, -100..100. Higher draws first; at equal priority the newest group wins. |
rows | table | Required, 1–8 rows. |
Row fields:
| Field | Type | Rule |
|---|---|---|
label | string | Required, max 48 bytes. Your own text (translate it yourself). |
keys | string, table or list | Required. 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. |
id | string | Optional, max 32 characters, unique in the group. Needed to patch with values. |
value | string or number | Optional, max 24 bytes. Drawn beside the label. |
hold | boolean | Optional. Sent to the page, but the shipped page no longer draws a hold tag. |
combo | boolean | Optional. The page joins the caps (one combination, not alternatives). |
dim | boolean | Optional. The page draws the row dimmed. |