ID:1825693
 
(See the best response by Super Saiyan X.)

Data
var/list/Cache

proc/Add2Cache(text)

if(!Cache)
Cache=list()

if(!Cache["Test"])
Cache.Add("Test")

Cache["Test"] += text

var/Data/Data = new

mob/verb
Cache_Add(t as text)
Data.Add2Cache(t)


Now this is obviously not the same context I'm using, but it is fundamentally the same. Why can't I check the contents of Data.Cache["Test"] with something like:
mob/verb
CheckData()
for(var/a in Data.Cache["Test"])
world<<a


Best response
I believe Cache["Test"] points to a string in this case.

I'm assuming by how you want to access the data, you intend Cache["Test"] to point to a list?


You can verify this with:

world << Cache["Test"]


if you want to add individual strings to a list, you'd have to initialize Cache["Test"] as a list, like:

        if(!Cache["Test"])
Cache.Add("Test")
Cache["Test"] = list()
By the way, you can set associations without adding the key first.
var data[0]
data["key"] = value

But in your case, you need to make sure Cache["Test"] is actually a list. What you did is add to null (which is the initial associated value) just like if you added to an uninitialized list variable.
Oh, alright. Haha, silly me. I knew it was something simple! anyways, thanks guys. Now the real challenge is finding out which one of you two deserves the up vote. xD
Them cables, though.