integer llGetListLength(list src)
Returns the number of elements in the
list src.
Example:
This example will make the object say "2" to the object owner.
llGetListLength returns the number of elements in a list,
not the maximum index in a list. To loop through all the elements in a list, use this:
Note: In the above example, the
length integer is
declared,
calling llGetListLength a single time, rather than calling it within the
for loop. As
this forum thread discusses, doing it this way results in a much faster loop.
HACK:
list MyList = ["a","b","c"];
integer length_slow = llGetListLength(MyList); //Slow
integer length_fast = (MyList != []); //Fast
integer neg_length_fast = ([] != MyList); //Fast & negative
This article wasn't helpful for you? Maybe the
related article at the LSL Portal is able to bring enlightenment.
Functions |
List