Sets the item at the specified index.
none
Name | Type | Description |
---|---|---|
value | value | The new value for the item. |
index | integer | The index of the item to set. The first item in the list is 1. |
The setItem function clears the previous value at a specified index and sets it to a new value. When called from a stimulus element, the stimulus item is set.
The following sets the first item of a text stimulus:
<trial myTrial>
/ onTrialEnd= [text.myText.setItem("Hello world!", 1);]
</trial>
The following sets the last item of a list:
<trial myTrial>
/ onTrialEnd= [item.myitems.setItem(values.newvalue, item.item.itemCount);]
</trial>