SpliceIntoRangeOfList |
Type | statement |
Dictionary | LCB |
Library | LiveCode Builder |
Syntax | splice <Source> into element <Start> to <Finish> of <Target>
|
Associations | com.livecode.list |
Summary | Removes the elements of Target from Start to Finish and inserts each of the elements of
Source into Target at Start.
|
Parameters | Name | Type | Description |
---|
Source | | An expression which evaluates to a list.
|
Start | | An expression which evaluates to a valid integer index of Target.
|
Finish | | An expression which evaluates to a valid integer index of Target.
|
Target | | An expression which evaluates to a list.
|
|
Example | variable tVar as List
put the empty list into tVar
variable tCount as Number
put 1 into tCount
repeat 3 times
push tCount onto tVar
end repeat
variable tVar2 as List
push "these" onto tVar2
push "are" onto tVar2
push "unwanted" onto tVar2
push 4 onto tVar2
splice tVar into element 1 to 3 of tVar2
|
Description | Use the splice syntax to insert the elements of one list into another list.
Note: put tList into element 1 to 3 of tList2 results in the removal of elements 1 to 3 of tList2 and the insertion of tList as an element, i.e. tList2 becomes the list [tList,element 4 of tList2, element 5 of tList2 ...]
Note: It is an error if either Start or Finish is out of range.
|
Tags | lists |