ID:154843
 
I'm trying to get inside one list, and whatever that list is equal to is the other list. How can I do this?

item_list
var/mob/m
New(mob/h)
m = h
m.Show_Icon("items")

Generate_Usable()


proc
Generate_Usable()
var/list/usable = list()

for(var/obj/items/usable/u in m.contents)
var/list/count = list()
count += u

for(var/obj/o in m.contents)
if(u.type == o.type) //found another of the same, add it to the count
count += o

usable.Add(u.name = count)

for(var/a in usable)
world << "usable: [usable[a]]"
var/list_contents = usable[a]
for(var/b in usable[a])
world << " contains: [b]"
Lists are same objects, so reference rule applies to them too. Therefore you can define new variable to access the list
var/list/List_Depth_2 = List_Depth_1[1]
In response to Zaoshi
Ok got it thanks.

item_list
var/mob/m
New(mob/h)
m = h
m.Show_Icon("items")

Generate_Usable()


proc
Generate_Usable()
var/list/usable = list()

next_obj
for(var/obj/items/usable/u in m.contents)

for(var/obj/same in usable) //only add one primary branch.
world << "same = [same]"
if(same.type == u.type)
world << "already have [u] as a primary."
continue next_obj


var/list/count = list()

for(var/obj/o in m.contents)
if(u.type == o.type) //found another of the same, add it to the count
count += o

usable += u
world << "usable added another primary branch: [u.name]"
usable[u] = count


for(var/a in usable)
world << "a is [a]"
var/list_contents = usable[a]
for(var/b in usable[a])
world << " contains: [b]"