SendDataToCollector
These pages are not yet fully reviewed. The LUIDA team is continuing to review and improve them. If you find anything wrong on these pages, or have questions that aren't resolved by reading them, please ask or report to the LUIDA team.
SendDataToCollector(label, value)StableData Logging- Fires
- On State Start · During State · On State Exit · Always-on events
Description
Pushes a single (label, value) pair into LUIDA's Data Collector scratchpad. Displayed in the State-listening Items editor as Push data to collector. The CCK equivalent is the Push data phase on LuidaDataCollectionGimmick.
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Should match an entry from Section A of the Configure data collector window. Off-registry labels work but won't appear in the gimmick inspector or auto-populate downstream field dropdowns. |
value | any | Any JSON-serializable value. For Bool/Int/Float/Vector2/Vector3, the gimmick + CCK sync header round-trip the value; for String, only this action path works (CCK has no string state). |
Side effects
- Writes
$.groupState.collectedData[label] = value. Lazily initializes$.groupState.collectedData = {}if it doesn't exist. - This is in-memory only, scoped to the current Cluster instance, not persisted to network. The value sits in the data scratchpad until
ProcessAndSaveCollectedData()snapshots it via the data calculator into a queued record. - No signals, no
callExternal. Within the calculator script, the same value is later readable asCOLLECTED_DATA[label]. - Subsequent calls with the same
labeloverwrite the previous value — the scratchpad is a single-slot key/value store, not an append log.
Example
In Tutorial 3 (Stroop), the TimeRecorder item records each trial's reaction time on Trial - Start exit:
// On State Exit (Customized Action)
$.state.isInTrial = false;
SendDataToCollector("timer", $.state.timer);Then the data calculator script (LUIDA-DataCollector Script Asset) reads the value back as COLLECTED_DATA["timer"] when assembling each record:
return {
stateLog: COLLECTED_DATA["stateLog"],
cond: CONDITION || {},
ans: $.getStateCompat("this", "isRed", "boolean") ? "R" : "B",
time: COLLECTED_DATA["timer"],
};Related
ProcessAndSaveCollectedData()— the next step in the data trio; snapshots the scratchpad into a queued record.UploadCollectedData()— the third step; flushes the queue to the Web Console.- Configure data collector — the visual builder that owns the label registry; pushed labels surface as field-source options there.
- Concepts → Data collection — explains the four data streams and the custom-data lifecycle.
- Tutorial 2 → TimeRecorder —
SendDataToCollector("timer", $.state.timer)on eachTrial - Startexit.