ID:160641
 
var/list/food=list("Egg"=list("White","Yolk"),"Bacon"=list("Meat","Fat"))


That is just a very simple example. What I'm trying to figure out is how to view them(white, yolk, meat and fat ect)?

client/verb
show_foods()
for(var/f in food)
src<<"[f] (Contains: [list2params(food[f])])"


This outputs:

"Egg (Contains: White&Yolk)"

While this is OK I want I want it to be spaced out, preferably with commas like this:

"Egg (Contains: White, Yolk)"

Is there any other way of doing this apart from using list2params()?
A nested for() loop should serve you well.

client/verb/show_foods()
for(var/f in food)
var/added = 0
var/string = "[f] (Contains: "
var/list/l = food[f]
if(!istype(l)) continue
for(var/c in l)
if(added) string += ", [c]"
else {string += "[c]"; added=1}
string += ")"
src << string
In response to CaptFalcon33035
Thank you.