Update List Variable
Runs on: Backend.
Changes a Streamer Variable or User Variable that holds a list, applying one operation atomically. A Get Variable, modify, Set Variable chain loses a change when two viewers trigger it within milliseconds of each other, because the second write erases the first. Update List Variable doesn't, so two !join or !addpoints commands both land.
Use it for queues, raffle entries, join lists and leaderboards.
Configuration
- Store: Broadcaster or Viewer. Viewer lists need the target user wired into the
Userinput. - Variable: The list variable to change. Only list-typed (
Array<...>) variables of the selected store are offered. - Operation:
- Add: Appends the
Iteminput at the list's Position (End or Start). - Add If Missing: Appends
Itemonly if nothing matches Match On (or the whole item, if Match On is "Whole Item"). Good for!join, where a viewer can't enter twice. - Update Or Add: Replaces the first entry matching Match On with
Item, or appends it if nothing matched. - Change Number Field: Object lists only. Adds Amount to Number Field on the entry whose Match On field equals Value. If nothing matches, appends a new entry with that field set to Value and Number Field set to Amount, so a chatter's first point isn't lost. This is the operation behind
!addpoints. - Remove Where: Removes every entry matching Match On and Value (or every occurrence of the whole item).
- Take First / Take Last: Removes one entry from that end of the list and outputs it on
item. A queue pop. FiresEmptyinstead when the list is empty. - Keep First / Keep Last: Trims the list down to Count entries.
- Clear: Empties the list.
- Add: Appends the
- Match On: For object lists, the field that identifies an entry (for example
username). "Whole Item" compares entire objects where offered. - Number Field: For Change Number Field, the number field to increment. Only number-typed fields are offered.
- Case Sensitive: Shown when the comparison is over text. Off by default.
Inputs
| Name | Type | Description |
|---|---|---|
Activate | pulse | Fires the effect even when every other input is inline. |
User | User or string | The viewer whose list entry to change. Only shown for a Viewer store. |
Item | matches the list's item type | The item to add, for Add, Add If Missing and Update Or Add. |
Value | matches the Match On field's type | The key to match, for Change Number Field and Remove Where. |
Amount | number | How much to add to Number Field. Defaults to 1. |
Count | number | How many entries to keep, for Keep First / Keep Last. Defaults to 10. |
Outputs
| Name | Type | Description |
|---|---|---|
Item | matches the list's item type | The entry that was added, updated or taken. |
Result | matches the variable's type | The list after the write. |
Empty | matches the variable's type | Fires, carrying the empty list, when Take First / Take Last runs on an empty list. |
Then | pulse | Fires after the effect runs, whether it succeeded or not. Wire it into another effect's Activate to sequence them. |
Outputs only reach a downstream node through forward wiring: Then into the next node's Activate, or the data outputs into a node already running from the same wave. A node that only pulls Item or Result backward, without the effect having run, gets nothing.
Example
Build a leaderboard: Array<Entry> broadcaster variable, where Entry is a custom type with username and score fields. On !addpoints <name> <amount>, use Update List Variable with Operation Change Number Field, Match On username, Number Field score, Value the chatter's name and Amount the points to add. For !next in a giveaway queue, use Take First on a queue: Array<string> broadcaster variable and send the popped item to chat.
Not for flow or overlay variables. They write back their whole array at the end of each run, which would overwrite an atomic change from the same run. Use a Broadcaster or Viewer variable for anything shared across viewers.