LlListInsertList/ko
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
명세
색인 | 양의 방향 | 음의 방향 |
---|---|---|
처음 | 0 | -길이 |
끝 | 길이 - 1 | -1 |
만약 start가 dest의 마지막 보다 이전이라면, src는 dest에 연결되며 공백(null) 항목을 더하지는 않는다. 이것을 피하기 위해서는, 목록의 처음 시작에 빈 항목들을 생성해야 한다. 음의 색인을 사용할 때도 비슷한 일이 발생한다.
예제
<lsl> list numbers = [3, "three", 2, "two", 1, "one"]; default {
state_entry() { llOwnerSay(llDumpList2String(numbers, ",")); // Object: 3,three,2,two,1,one integer index = llListFindList(numbers, [2]); if (index != -1) { numbers = llListInsertList(numbers, [2.5, "two and a half"], index); llOwnerSay(llDumpList2String(numbers, ",")); // Object: 3,three,2.500000,two and a half,2,two,1,one } }
} </lsl>
기록
Bear in mind that the source list will remain unchanged. Instead, a new list will be produced. So, it's important that you capture this with a variable (unless you are acting directly on the results.)
Tip! To insert something at the start of a list, you can just add the two lists (putting the list with the new item(s) first)
<lsl> list oldList = ["B", "C", "D"]; list newItem = ["A"]; list newlist = newItem + oldList; </lsl>
함께 보기
이 글이 유용하지 않으세요? LSL Wiki의 관련항목이 도움을 줄 수 있을 지도 모릅니다.