ID:149380
 
I have an associative list that stores variables as a text screen like list["blah"] = an object. However I don't know how I would search the list. The list is defined as:
var
list
obj/blah/blahlist = list()
pertend that a few variables are stored here like so
blahlist[usr.name] = new(src)
...
I tried searching the list as
for(var/obj/blah/X in blahlist)
usr << X.variable

However it does not work.
I tried searching the list as
for(var/obj/blah/X in blahlist)
usr << X.variable

However it does not work.

for(var/X in blahlist) //loop through all text strings in list
var/obj/blah/O = blahlist[X] //find obj referred to by that text string
usr << O.variable //now display O's 'variable' var


Each item in the list, you have to remember, is a text string. When you access the list by that name, it comes up with an associated value.