Don't click here unless you want to be banned.

LSL Wiki : CSV

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org

CSV


CSV stands for Comma Separated Value. Its the standard for displaying list information as a string. Since the days before llDumpList2String() a CSV (using llList2CSV()) was the only way to transfer list values over string interfaces (like object talk (whisper, say, shout) or link messages). Comma Separated Values are... well... separated by commas.

Examples

The, Quick, Brown, Fox, Jumped, Over, The, Lazy, Dog
Foo, Bar, The, And, Red, Goo

The space after the comma is optional, so the following is also a valid CSV string:

Mistress,Torrid,Aimee

CSV Functions

llList2CSV
llCSV2List


The CSV functions are nice for passing multiple parameters as a single string (using llMessageLinked for example). You can even pass complex types like vectors or rotations even though their string representations have commas. LSL handles the fuss for you, which indicates that the functions don't actually implement the most basic case of CSV, but some version of it with built in escaping. More specifically, commas inside angle brackets ("<" and ">") are not interpreted as separators.

BUT, one thing to be aware of when unpacking the string back into a list is that the type information associated with any given list entry is lost (there are ways around this, see the llCSV2List entry). It's up to you to know what the type of a given list item is and you must use llList2String and cast the result to the correct type as in:

link_message(integer sender, integer num, string str, key id)
{
    list tokens = llCSV2List(str);
    vector pos = (vector) llList2String(tokens, 1);
}

Lists that haven't been gone through CSV conversion work normally as described under lists.

llDumpList2String and llParseString2List perform the same functions, but allow variable separators, not just commas. This can be better when working with vectors, rotations, complete sentences, etc.


Lists / Functions
There is no comment on this page. [Display comments/form]