Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Lists of Lists and Hash tables

Gruntos Baxter
Registered User
Join date: 15 Jan 2007
Posts: 20
02-23-2007 08:17
I tried to make a list in a list yesterday and it failed so I take it this is not supported?
I see List of all sorts but not lists of lists

for example
list fred = [1,2 3 4]
list wilma = [5,6,7,8]
list all = [fred,wilma]

fails with
Function Args: s
Local List: (null)
Function Args: (null)

Failing that can I pass the address of a list to a function and use that? liek a referance or a pointer?

The other thing is I create a string of "fred,wilma" and use llParseString2List but how do i then de-referance the lists as I will then get ["fred","wilma"] and not address of list fred and wilma.

The more I program I find serious limitations using SL Scripting

Is there a hashing system ?
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
02-23-2007 08:31
No list of lists.
No pointers.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-23-2007 09:28
CODE

list fred = [ "barney", "dino" ];
list wilma = [ "betty", "pebbles" ];
list all = fred + wilma; // will beone list containing the contents of both fred and wilma


If each list is a fixed known length then use a strided list


You can pass a list to a function, but they are pass by value so its very easy to eat script memory.
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
02-23-2007 12:22
Yeah, LSL is pretty limited in this respect.

You can, if you really want to, store a list of strings that you parse into lists, like this:

list fredwilma=["1,2,3,4", "5,6,7,8"];

Then use llCSV2List and llList2CSV to get at the sublists. It's totally inefficient.
Gruntos Baxter
Registered User
Join date: 15 Jan 2007
Posts: 20
02-23-2007 14:36
what I wanted to do was
run a for next loop running a different list on each index

saying that <thinks aloud> I could create one list containing long strings and then run pharstring2list on each one

that might work
somthing like fred = ["this is list one","this is list 2",...]
and look around each list element which is a string and then pharse that

Yea

Same No * or &
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-23-2007 14:50
or you could just check which index your in and pass a copy of the list to a function.

CODE

if(1 == index) Process(Fred);
else if(2 == index)Process(Wilma);


messy but workable. At least for small numbers.

What are you actually trying to do?