ID:263445
 
Code:
GM_Player_Status()
set category = "GM Commands"
var/mob/M = input("View someones vars","Player Status") as null|mob in world
if(!M)return
var/html = null
html +="<title>[M.name]</title>"
html +="<body bgcolor=black>"
for(var/V in M.vars)
if(!M.vars[V])continue
if(istype(M.vars[V],/list))
for(var/a in M.vars[V])
if(!length(a))continue
html+="<font color=white>[a]<font color=blue> <b>:</b> <font color=red>[M.vars[a]]</font><br>"
html+="<font color=white>[V]<font color=blue> <b>:</b> <font color=red>[M.vars[V]]</font><br>"


Problem description:
I am trying to get the output off the stuff in the list, but I just get /list in it.
Use for().

Example:

mob
verb
who()
var/list/l = list()
var/mob/player/M = /mob/player
for(M in world)
l += M
for(M in l)
usr << "[M] : [M.key] <br>" //the <br> is there so that it will show each player one a different line.


It's not the best example since you can skip the whole adding them to a list when doing who, but that would be how you could see whats in the list.

Untested, but I think it would work like that. Not 100% though.
In response to Pyro_dragons (#1)
I am not making a who() verb, I am trying to access every single var of a mob, And some vars happen to be lists, so I am trying to see all items in the list. And that is a horrible way to do a who verb.
You'll probably want to do something recursive.

proc/DisplayList(list/l, mob/m)
for(var/v in l)
if(l[v])
if(islist(l[v]))
m << "[v]: List:"
DisplayList(l[v],m)
else
if(isdatum(l[v]))
m << "[v]: Object:"
var/datum/d=l[v]
DisplayList(d.vars,m)
else
m << "[v]: [l[v]]"
else
if(islist(v))
m << "List:"
DisplayList(v, m)
else
if(isdatum(v))
m << "Object:"
var/datum/d=v
DisplayList(d.vars,m)
else
m << "[v]"


That's untested, and requires that you have a islist() and isdatum() function. You just call DisplayList(target.vars, person-you-want-to-get-the-output), and off it goes.
Ever heard of 'list2params()', or perhaps 'list2text()'?
Here's a quickly whipped-up one.
proc
list2text(list/L,sep="\n")
if(!islist(L)) return
for(var/item in L) . += "[item][sep]" //append to '.' (turned into a text string)
return copytext(.,1,lentext(.)-lentext(sep)+1) //make sure the last 'sep' isn't included in the returned value


You could modify it to display associated values too if wanted, etc.