llList2Vector
function
Function syntax
vector llList2Vector(list src,// Source list containing the element of interest.integer index// Zero-based index of the entry.
);- Returns
vector- Energy
- 10
Returns the vector value at index in the list src. Returns ZERO_VECTOR if the index is out of bounds or if the value cannot be type-cast.
Returns a vector that is at index in src.
vector result = llList2Vector([], 0);Caveats
Section titled “Caveats”- When used to typecast from a string it will result in a
ZERO_VECTOR - A true typecast will solve this: (vector)
llList2String(src, index); - Unfortunately, if it was already a vector type, using
llList2Stringwill cause the decimal values to be truncated to six decimal places. - In any string representation of a vector such as
llList2String(src, index), or (string)llList2Vector(src, index), spaces are automatically added after the commas. When received by alisten, make sure NOT to parse by spaces.
Examples
Section titled “Examples”Example 1
10 collapsed lines
// Best viewed in Chat History (ctrl-h)default{ state_entry() { list my_list = ["a", 1, 2.0, <1,2,3>, <1,2,3,4>, llGetOwner()]; integer i = ~llGetListLength(my_list); while(++i) { llOwnerSay("string=" + llList2String(my_list,i) + "\n integer=" + (string)llList2Integer(my_list,i) + "\n float=" + (string)llList2Float(my_list,i) + "\n vector=" + (string)llList2Vector(my_list,i) + "\n rot=" + (string)llList2Rot(my_list,i) + "\n key=" + (string)llList2Key(my_list,i) ); } }}Known issues
Section titled “Known issues”From the issue templates included by the wiki article:
- SVC-798 (nf): Perform typecasting with all llList2* functions
See also
Section titled “See also”Functions
Section titled “Functions”Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.