ID:266358
 
Can lists be nested inside of lists, like so?:

var/list/list1 = list("list1" = list(1,2),"list2" = list(3,4))

And even nested further inside of that?
Lord of Water wrote:
Can lists be nested inside of lists, like so?:

var/list/list1 = list("list1" = list(1,2),"list2" = list(3,4))

And even nested further inside of that?

what about...
var/list/list1 = list(list2,list3,list4)
var/list/list2 = list(a,b,c)
var/list/list3 = list(1,2,3)
var/list/list4 = list(list5,list6)
var/list/list5 = list(4,5)
var/list/list6 = list(6,7)

FIREking
In response to FIREking
what about...
> var/list/list1 = list(list2,list3,list4)
> var/list/list2 = list(a,b,c)
> var/list/list3 = list(1,2,3)
> var/list/list4 = list(list5,list6)
> var/list/list5 = list(4,5)
> var/list/list6 = list(6,7)
>

FIREking

You'll get a compiler error with this since list1 will try to add variables to it that don't exsist yet.
In response to Theodis
Theodis wrote:
what about...
> > var/a
> > var/b
> > var/c
> > var/list/list1 = list(list2,list3,list4)
> > var/list/list2 = list(a,b,c)
> > var/list/list3 = list(1,2,3)
> > var/list/list4 = list(list5,list6)
> > var/list/list5 = list(4,5)
> > var/list/list6 = list(6,7)
> >

FIREking

You'll get a compiler error with this since list1 will try to add variables to it that don't exsist yet.

uh, considering the things in those lists actually mean something, i thought everyone knew what i was trying to do, or maybe you are just trying to be funny?

can you put lists in side of lists in the method ive shown?

var/list/list1 = list()
var/list/list2 = list(list2)

FIREking
In response to FIREking
uh, considering the things in those lists actually mean something, i thought everyone knew what i was trying to do, or maybe you are just trying to be funny?

You are posting to Newbie Central so everyone here might not know what you are meaning and not understand the errors your code contains.

can you put lists in side of lists in the method ive shown?

var/list/list1 = list()
var/list/list2 = list(list2)

FIREking

Yep you can have as many lists in lists as long as you have the memory to make the lists. Just consider world.contents. It is a list that contains area, mobs, obj, and turfs. The areas themselves then have a list with mobs, objs, and turfs. These all have lists within them which in turn can have lists in them.
In response to Theodis
Theodis wrote:
uh, considering the things in those lists actually mean something, i thought everyone knew what i was trying to do, or maybe you are just trying to be funny?

You are posting to Newbie Central so everyone here might not know what you are meaning and not understand the errors your code contains.

good point, dont confuse other people with my problems, i like that!

can you put lists in side of lists in the method ive shown?

var/list/list1 = list()
var/list/list2 = list(list2)

FIREking

Yep you can have as many lists in lists as long as you have the memory to make the lists. Just consider world.contents. It is a list that contains area, mobs, obj, and turfs. The areas themselves then have a list with mobs, objs, and turfs. These all have lists within them which in turn can have lists in them.

coolness! i should have thought of atom.contents, where you have an object in your contents that contains a list of items, such as a bag. I know ive done that before, and that was basically a list inside of a list. And for every object inside of the bag, each had a list for its contents as well

world
contents
player
contents
bag
contents
apple
contents
null

FIREking
In response to FIREking
Of course if you don't know if something will work you can always just test it. Use some output statements to see if it works, but of course we already know this does so no point in doing it now :p