guihooks Reference
Module defined in `lua/common/guihooks.lua`. Bridge between Lua and the JavaScript/CEF UI layer. Provides functions to trigger UI events, send streaming data, display messages, and graph debug data.
Module defined in lua/common/guihooks.lua. Bridge between Lua and the JavaScript/CEF UI layer. Provides functions to trigger UI events, send streaming data, display messages, and graph debug data.
Exports
Functions
M.trigger(hookName, ...)
Fires a named event to the UI layer with JSON-encoded arguments.
- Parameters:
hookName- string - Event name (e.g., "VehicleChange", "Message")...- any - Arguments to JSON-encode and send
M.triggerClient(targetDsmId, hookName, ...)
Fires a UI event to a specific client/display.
- Parameters:
targetDsmId- number - Target display state manager IDhookName- string - Event name...- any - Arguments
M.triggerRawJS(hookName, rawJs)
Fires a UI event with raw (pre-encoded) JavaScript data. Wraps the data in [...] brackets automatically.
- Parameters:
hookName- string - Event namerawJs- string - Pre-formatted JS data (will be wrapped as[rawJs])
M.triggerStream(streamName, streamData)
Sends streaming data to a named UI stream.
- Parameters:
streamName- string - Stream identifierstreamData- table - Data to JSON-encode and send
M.queueStream(key, value) / M.send(key, value)
Queues stream data to be sent on the next sendStreams() call. Alias: M.send.
- Parameters:
key- string - Stream namevalue- any - Stream data
M.sendStreams()
Flushes all queued stream data to the UI. Called from the graphics step.
M.message(msg, ttl, category, icon)
Displays a UI toast/notification message.
- Parameters:
msg- string - Message textttl- number|nil - Time to live in seconds (default: 5)category- string|nil - Message category (default: "")icon- string|nil - Icon identifier
M.graph(a, ...)
Sends data to the "Generic Graph" UI app. Each argument defines a graph line.
- Parameters:
a, ...- table - Each:{key, value, scale, unit, renderNegatives, color}
- Returns: table - Processed values array
M.graphWithCSV(filename, ...)
Like graph() but also records data to a CSV file for later export.
- Parameters:
filename- string|nil - CSV filename...- table - Graph line definitions
M.graphWithCSVWrite()
Writes the accumulated CSV graph data to disk.
M.reset()
Resets stream state and triggers a VehicleReset UI event.
Variables
M.updateStreams
- Type: boolean
- Description: Flag indicating whether streams should be sent on the next graphics step
Internal Notes
- Uses
obj:queueHookJS()on vehicle Lua side,be:queueHookJS()on game engine side - Stream data is cached and sent in batch during
sendStreams()to avoid per-frame overhead - The
checkStreamsAndVehicle()function detects vehicle changes and emits VehicleChange/VehicleReset events graph()auto-assigns jet-colormap colors when not specified- Only sends messages when
playerInfo.firstPlayerSeatedis true
graphpath Reference
Module defined in `lua/common/graphpath.lua`. Graph-based pathfinding library implementing Dijkstra's algorithm with extensions for road networks - supports edge properties (drivability, speed limits,
inputFilters Reference
Module defined in `lua/common/inputFilters.lua`. Defines global constants for input filter types used to classify input device sources.