Difference between revisions of "ListToWholeNumbers"

From Second Life Wiki
Jump to: navigation, search
(New page: {{LSL Header}} __NOTOC__ <div id="box"> == Function: list ListToWholeNumbers(list {{LSL Param|mylist}}); == <div style="padding: 0.5em;"> Removes one item from a list. See also: [...)
 
Line 23: Line 23:
 
</lsl>
 
</lsl>
  
list myWholeNumberList = ListToWholeNumbers(1.04,10.789,4.643);
+
list myWholeNumberList = ListToWholeNumbers(1.04,10.789,4.643);<br />
 
//yields [1,10,4]
 
//yields [1,10,4]
  

Revision as of 05:53, 13 July 2008

Function: list ListToWholeNumbers(list mylist);

Removes one item from a list.

See also: Lists

<lsl> list ListToWholeNumbers(list myList) {

   list myConvertedList = [];
   integer ListLength = llGetListLength(myList);
   integer f = 0;
   while (f <= (ListLength - 1)) {
       string w =llList2Key(myList, f);
       integer y = (integer)w;
       myConvertedList = (myConvertedList=[]) + myConvertedList + y;
       f=f+1;
       }
   return myConvertedList;

}

</lsl>

list myWholeNumberList = ListToWholeNumbers(1.04,10.789,4.643);
//yields [1,10,4]