Talk:LlCSV2List

From Second Life Wiki
Jump to navigation Jump to search


Strife, there is a cut-off sentence here.

"llList2Vector, llList2Float, llList2Integer, llList2Rot should not be....."

I can't correct as I don't know how you meant to finish the sentence.

--Chaz Longstaff

Yeah I forgot to delete it after I wrote the table, it would have been a huge amount of text to explain everything that is in the table without the table and I only realized that as I was trying to do so. -- Strife Onizuka 16:42, 14 July 2008 (PDT)

Small sugestion.

Whouldnt it be nice if every code exemple has 2 rows that say what the code is doing, and maybe how the output looks and can be used?

I think this is a exemple of code that creats more confusion then help.

Specialy windows users who create code by drag and drop, or click and drag have this habbit. --Anylyn Hax

It's common practice to put the script output after the script or in the script in comments. -- Strife Onizuka 16:03, 12 August 2007 (PDT)
There is a sentence on here that says: "Do not confuse this function with the CSV format, it is not the CSV format." What does this mean? Are newlines not consumed and parsed? I will verify this in the future and make the appropriate changes but the above comment isn't useful... how is it different? Epilort Byrne 16:03, 8 March 2010 (UTC)

According to the page all leading and trailing spaces are removed....

This is not true according to this:- <lsl>integer line_count; integer all;

key get_line_count; key line;

list text_list;

default {

   on_rez(integer param)
   {
       llResetScript();
   }
   state_entry()
   {
       get_line_count = llGetNumberOfNotecardLines("Text Notecard");
       all = 0;
       line = llGetNotecardLine("Text Notecard", all);
   }
   changed(integer change)
   {
       if(change & CHANGED_INVENTORY)
       {
           llResetScript();
       }
   }
   dataserver(key qid, string data)
   {
       if(qid == get_line_count)
       {
           line_count = (integer)data;
       }
       if(qid == line)
       {
           if(all < line_count)
           {
               //text_list = text_list + llStringTrim(llGetSubString(llStringTrim(llList2String(llCSV2List(data), 3), STRING_TRIM), 1, -2), STRING_TRIM);
               text_list = text_list + llList2String(llCSV2List(data), 3);
               line = llGetNotecardLine("Text Notecard", ++all);
           }
           if(all == line_count)
           {
               llInstantMessage(llGetOwner(), llDumpList2String(text_list, "\n"));
               ++all;
           }
       }
   }

}</lsl>Reading from this style notecard:-


<lsl>value , value , value , < This is a test text > value , value , value , < This line is second > value , value , value , < This line is here decribing itself > value , value , value , < This one isn't, > value , value , value , < niether is this one. > value , value , value , < This line is another line > value , value , value , < This is another line as well > value , value , value , < so is this, > value , value , value , < and this. > value , value , value , < This line marks the end of the test text ></lsl>


The IMmed result of the oranged-out line (my version before reading that llCSV2List supposedly trims the strings) is clean with no spare whitespace. The result of the untrimmed version (for the sake of ease we will ignore the keeping of the "<"s and ">"s for now. ok?) has a leading space before each line. The following is a mock up of the results since I have excluded some valuable info (thus the "value", "value" etc.).


[11:12]Trimming Object:This is a test text....etc.

[11:12]Object: This is a test text....etc. (note the space before "This")


Even though I have mocked it up, (ignoring the fact that my trimming code chops the "<>"s off as well) unless a leading space is supposed to be applied to vectors the claim that leading whitespace is trimmed off is false. -- Eddy (talk|contribs) 18:53, 13 June 2009 (UTC)

I don't have time to get in world at the moment (I need to get to bed) but I'll look into this in the coming days. -- Strife (talk|contribs) 12:43, 14 June 2009 (UTC)

Keeping Nulls

I need to do some tests, but the page here doesn't mention if this does or does not keep null entries, e.g. if I pass the function "1,2,,3" do I get ["1","2","3"] or ["1","2","","3"]? -- Felis Darwin 18:16, 6 March 2014 (PST)

I think it does. I know LSLEditor does. Just run the following script. -- Strife (talk|contribs) 19:22, 6 March 2014 (PST)

<lsl>string test(string t, integer len){

   return "\n- ["+t+"]: " +llList2String(["Yes", "No"], llGetListLength(llCSV2List(t)) != len);

}

default {

   state_entry() {
       llOwnerSay("Do the following parse as expected?" +
           test("1,,2", 3) +
           test("1,,", 3) +
           test(",,2", 3) +
           test(",,", 3) );
   }

}</lsl>