Difference between revisions of "TrimList"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with "this function will trim a list of strings for the output of a dialog box. '''Function''' <lsl> list TrimList(list dlist, integer length) { integer i; list temp = []; …")
 
Line 5: Line 5:
list TrimList(list dlist, integer length)  
list TrimList(list dlist, integer length)  
{
{
     integer i;
     integer dlist = llGetListLength(dlist)+1;
     list temp = [];
     list temp = [];
     for(i=0;i<llGetListLength(dlist);i++)
     while(~--dlist)
    {
         temp += llGetSubString(llList2String(dlist,i),0, length-1);
         string text = llList2String(dlist,i);
        if (length < llStringLength(text))
        {
            length = length-1;
            string newstring = llGetSubString(text,0, length);
            temp += newstring;
        }
        else
        {
            temp += text;
        }
    }
     return temp;
     return temp;
}
}

Revision as of 20:09, 20 October 2011

this function will trim a list of strings for the output of a dialog box.

Function <lsl> list TrimList(list dlist, integer length) {

   integer dlist = llGetListLength(dlist)+1;
   list temp = [];
   while(~--dlist)
       temp += llGetSubString(llList2String(dlist,i),0, length-1);
   return temp;

}

</lsl>