SpliceBeforeElementOfList |
Type | statement |
Dictionary | LCB |
Library | LiveCode Builder |
Syntax | splice <Source> before element <Index> of <Target>
|
Associations | com.livecode.list |
Summary | Inserts each of the elements of Source into Target before element at index Index.
|
Parameters | Name | Type | Description |
---|
Source | | An expression which evaluates to a list.
|
Index | | 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 2 into tCount
repeat 3 times
push tCount onto tVar
end repeat
variable tVar2 as List
push 1 onto tVar2
push 5 onto tVar2
splice tVar before element 2 of tVar2
|
Description | Use the splice syntax to insert the elements of one list into another list.
Note: put tList before element 2 of tList2 results in the insertion of tList as an element, i.e. tList2 becomes the list [element 1 of tList2,tList,element 2 of tList2, element 3 of tList2 ...]
Note: It is an error if Index is out of range.
|
Tags | lists |