tech/techCapture Reference
Module defined in `lua/common/extensions/tech/techCapture.lua`. Records and replays tech layer communication (requests/responses) for debugging and testing co-simulation sessions.
Module defined in lua/common/extensions/tech/techCapture.lua. Records and replays tech layer communication (requests/responses) for debugging and testing co-simulation sessions.
Exports
Functions
M.onInit()
Hook: Initialize capture state.
M.enableRequestCapture(captureName, flushInterval)
Start capturing outgoing requests to a file.
- Parameters:
captureName- string - Name for the capture sessionflushInterval- number|nil - How often to flush to disk
M.disableRequestCapture()
Stop capturing requests and close the file.
M.enableResponseCapture(captureName)
Start capturing incoming responses to a file.
- Parameters:
captureName- string - Name for the capture session
M.disableResponseCapture()
Stop capturing responses and close the file.
M.openRequestFile(captureName)
Open a request capture file for writing.
- Parameters:
captureName- string - Capture session name
- Returns: string - Output filename
M.recordRequest(request)
Record a single request to the capture file.
- Parameters:
request- table - Request data to record
- Returns: boolean - true on success
M.closeRequestFile()
Close the request capture file.
M.isRecordingRequests()
Check if request recording is active.
- Returns: boolean - true if recording requests
M.openResponseFile(captureName)
Open a response capture file for writing.
- Parameters:
captureName- string - Capture session name
M.recordResponse(response)
Record a single response to the capture file.
- Parameters:
response- table - Response data to record
M.closeResponseFile()
Close the response capture file.
M.isRecordingResponses()
Check if response recording is active.
- Returns: boolean - true if recording responses
M.getAllRelatedFiles(pathToFile, completeMatch, intermediateMatch)
Find all capture files related to a given file path.
- Parameters:
pathToFile- string - Path like/path/to/file.<ext>or/path/to/file.<XXX>.<ext>completeMatch- string - Extension for exact match filesintermediateMatch- string - Extension for intermediate match files
- Returns: table - Array of matching file paths
M.getCaptureTypeFromFile(inputFilename)
Determine the capture type (request/response) from a file's header.
- Parameters:
inputFilename- string - Capture file path
- Returns: string|nil - Capture type or nil
M.filterFilesByHeader(files, captureType, captureMerged)
Filter a list of capture files by their header type.
- Parameters:
files- table - Array of file pathscaptureType- string - Type to filter forcaptureMerged- boolean - Include merged captures
- Returns: table - Filtered file list
M.injectMessage(payload, callback)
Inject a recorded message for replay.
- Parameters:
payload- table - Message payload to injectcallback- function - Callback after processing
- Returns: table, boolean - Processed request and whether to continue
M.export()
Export current capture state for serialization.
- Returns: table - Capture state
M.import(info)
Import/restore capture state.
- Parameters:
info- table - Previously exported capture state
Hooks
onInit
Internal Notes
- Uses
techCommunicationmodule for message format compatibility - Capture files use a length-prefixed binary format matching the wire protocol
deletePreviousCaptureWithSameNameremoves old captures when starting new onesbuildCaptureFilename/prepareFileFromCaptureNamehandle file namingconvertBinaryDataToStringhandles binary payload serialization
networking/editorToolchain Reference
Module defined in `lua/common/extensions/networking/editorToolchain.lua`. TCP server extension for editor toolchain communication - receives commands from external editors/tools.
ui/imgui_api Reference
Module defined in `lua/common/extensions/ui/imgui_api.lua`. Base ImGui API module - provides the global Lua ImGui context variable that other modules populate.