|
falney Finney
Freedom is just a word
Join date: 18 Dec 2006
Posts: 66
|
10-05-2007 09:20
Ive hit a stumbling block. Im still new to lsl but picking it up quickly when I put my head to it.... But was wondering if you could throw me a bone.....
Ive been working on a project for some one and so far so good though I came to a point where I needed to use a list!
So... Ive read the wiki... Ive understood it (I think) and built a list.... Populated it with vari's in one object.... done a list2csv then transfered it to another object through llsay and transfered it back to a list..... All fine.... wonderfulll....
How do I use the list? I want to pull the vari's out so I can use one of them for verification that its gotten to the right destination! :/
Thanks
_____________________
Self proclaimed Genius
Pessimist is only a name that an optimist calls a realist!
Heterosexuality is just a fancy word for legalized sexism
|
|
Stephen Zenith
Registered User
Join date: 15 May 2006
Posts: 1,029
|
10-05-2007 09:47
Use llList2String, llList2Integer etc - they aren't named too well, but you give them the list and the index, and they return the item at that position.
|
|
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
|
10-05-2007 09:48
You mean how to you get a value out of the list?
llList2String,llList2Float, llList2Integer, llList2Key, llList2List, llList2ListStrided, llList2Rot, llList2Vector and llGetListEntryType.
|
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
10-05-2007 09:48
There's a couple of different ways depending on what you're going to do:
There are different functions depending on the variable type. For example, given this list:
string element;
list MyList = ["element 1", "element 2", "element 3"];
element = llList2String (MyList, 0); //return 1st element in list
or:
element = llList2String (MyList,1); //return 2nd element in list... etc
depending on the variable type, there's the appropriate list to variable type function
llList2String() llList2Integer() llList2Rot() llList2List() llList2Key() llList2Float() llList2Vector()
You can also search a list for a specific element...
default { state_entry() { list src = ["The", "Quick", "Brown", "Fox", "Jumped", "Over", "The", "Lazy", "Dog"]; list test;
test = ["Brown"]; // What we want to find. integer foxColorIndex = llListFindList(src, test); // Returns 2.
test = ["Jumped", "Over"]; integer whatFoxDidIndex = llListFindList(src, test); // Returns 4.
test = ["Quick", "Fox"]; integer thereIsNoFox = llListFindList(src, test); // Returns -1. } }
hope that helps...
|
|
falney Finney
Freedom is just a word
Join date: 18 Dec 2006
Posts: 66
|
10-05-2007 10:35
Ah! That last post is very close.... Ive figured out WHAT I need to do just not how! I didnt word my first post well...
I need to parse what happens before the first comma on a list then I can use it in an if statement to verify that the that the message is actually for that person
so its list is [avi_key, vender_key, sim_vender_is_in, etc] I want to pull out the avi key only
Then after I have that in a vari I can throw it through an if statement for verification... Sorry Im suffering from a cold and a lack of sleep so Im not very coherent...
Friend just told me to use
avikey = llList2Key(prodlist, 0);
So Ill give that ago! Thanks all
_____________________
Self proclaimed Genius
Pessimist is only a name that an optimist calls a realist!
Heterosexuality is just a fancy word for legalized sexism
|