opx_infinitychat
Client
Last updated on
The chat contract on the client — this player's log, completions and the box's on/off switch.
local chat = OPX.Api.Get('chat')From client code inside opx_infinity. Every function answers { ok = true, value } or { ok = false, error = code }. None yields.
AddMessage
Adds a line to this player's log only.
chat.AddMessage(message)Parameters
- message:
string | table— or{ kind?, author?, text }kinddecides the look:say(default),chat,error,warning.
Returns
Resulttrue— errorchat.invalidMessage
chat.AddMessage({ kind = 'error', author = 'NCPD', text = 'You are wanted.' })ClearMessages
Empties this player's log.
chat.ClearMessages()Returns
Resulttrue
AddSuggestion
Adds or replaces one completion in the input line.
chat.AddSuggestion(command, help, params)
chat.AddSuggestion({ command, help, parameters })Parameters
- command:
string— alsonamein the table form. - help?:
string - params?:
table— alsoparametersin the table form.
Returns
Resulttrue— errorchat.invalidCommand
chat.AddSuggestion('/opx.mything', 'Does my thing')RemoveSuggestion
Removes one completion.
chat.RemoveSuggestion(command)Parameters
- command:
string
Returns
Resulttrue
SetEnabled
false closes the box and refuses to open it.
chat.SetEnabled(enabled)Parameters
- enabled:
boolean
Returns
Result— the new state
IsEnabled
chat.IsEnabled()Returns
Resultboolean