Strided Lists

505936

I’ve got about half of my inventory into my database and have begun work on an actual web-based vendor. To cut down on the amount of data sent back and forth, I’m going setting both my individual entries and fields to be delimited with the same pattern. To parse that information in-world, I’m using something called strided lists. I haven’t used them before and thought I would give it a go. I couldn’t quite get the hang of them at first, but then I realized that I needed to chop off the first entry in my list before I could get the correct value in the second field for all my items. Chop off the first two for field 3, and so on. It would be ideal if this was easier to work with.

Visit Applewood

Posted via email from dedricmauriac’s posterous

2 Responses to Strided Lists

  1. You don’t need to delete from strided lists. Access an element with llList2[TYPE](list,0) for the first element, llList2String(list,2) for the 2nd, and so on. If you are iterating in a loop, do this:

    // 3 element strided list, a float, a string and a vector X 2
    list Thelist = [1,”item1″,,2.222,”item 2″,];

    integer STRIDE = 3; // 3 elements stored in a strided list
    j = llGetListLength(Thelist);
    int i;
    for (i=0; i< j; i+= STRIDE) // this will loop twice for the above list
    {
    float a = llList2Float(Thelist,I+0); // 1, then 2.222
    string b = llList2String(Thelist,i+11); //"item1", then "item2"
    vector c = llList2Vector(Thelist,i+2); //, then
    }

  2. Ferd, the way you outlined is usually how I would go about this. I just found it to be so inconvenient that the method that is provided to us for strided lists is really pointless. There are better ways to do it – as you have pointed out. Even the method they made is very confusing to use. It’s only useful for the first field in a record. Any more fields and you’ll be doing some extra legwork to get at that data.

%d bloggers like this: