• 28Oct

    Heya, everybody. I wrote a somewhat useful LSL function, and I wanted to stash it somewhere that I wouldn’t forget it. Then I thought, “I’ll just make a blog post, and everybody can benefit. Maybe I’ll get some suggestions on how to improve it, too.”

    So, here you go: it’s a function to create a new list of a certain size, filled with zeroes. This is such a small and rather obvious function, so I hereby release it to the public domain. Yay!

    // Create a new list which is filled with +length+ 0's.
    list generate_filled_list( integer length )
    	list new_list;
    	integer counter = 0;
    	// Fill it up 10 at a time, until we have at least enough.
    	for( ; counter < length; counter += 10 )
    		new_list += [0,0,0,0,0,0,0,0,0,0];
    	// Return only the needed amount.
    	return llList2List( new_list, 0, length - 1 );

    Posted by Jacek Antonelli @ 9:51 pm

One Response