Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

sublists

Roslyn Korobase
Registered User
Join date: 3 Mar 2007
Posts: 23
04-20-2007 07:08
Am i corrent in thinking that sub lists or lists of lists are not possible?

What i wanted to do was somthing like

list colours = ["RED","GREEN","BLUE","ORANGE","YELLOW","WHITE"];
list numbers = ["1","2","3","4"];
list mylist[colours,numbers];


I am trying to create a configuration dialog window that has many options and the tidyest and shorted way of doing this was with lists of lists. But alias after writing loads of code then comming to use llList2List and discovering it didn't do what i expected.

Any other sugestions on ways to do this, the biggest problem is that the lists are all of different lengths as they are going to llDialog in the end.

Thanks

Roz
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
04-20-2007 07:11
CODE
list mylist = colors + numbers;
_____________________
http://slurl.com/secondlife/Together
Scott Bristol
Registered User
Join date: 20 Jan 2007
Posts: 13
04-20-2007 07:19
Sublists are not possible in LSL.

You could emulate them with one list of all elements (concatenation of your sublists) and one list of indices to the start position of each sublist.
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
04-20-2007 07:30
You can also emulate sublists to some extent using strided lists.

http://rpgstats.com/wiki/index.php?title=List#Strided_Lists

But I'm not certain this accomplishes what you're trying to do.
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
04-20-2007 07:44
CODE
list options = ["RED","GREEN","BLUE","ORANGE","YELLOW","WHITE","1","2","3","4"];
list offsets = [0,6,10];

showDialog(integer mnuNumber, string mnuTitle, integer mnuChannel)
{
llDialog(llGetOwner(),
mnuTitle,
llList2List(options,
llList2Integer(offsets, mnuNumber),
llList2Integer(offsets, mnuNumber + 1) - 1),
mnuChannel);
}

default
{
touch_start(integer total_number)
{
showDialog(0, "Menu 0", 1);
showDialog(1, "Menu 1", 1);
}
}
...what Scott said.