ID:1462174
 
(See the best response by DarkCampainger.)
Code:
var/icon/msrc = new('icon.dmi')
msrc.Insert(anothericon,"icon_state",SOUTH,1,0,1)
for(var/s in icon_states(msrc))
usr << s
sleep(world.tick_lag)


Problem description:
Not sure if a bug or my fault, so I'm just gonna ask here. Can someone please explain to me why this particular code doesn't work? It is simple, straight to the point, being used in a fresh new project.
What does the new() achieve?
In response to Jittai
The new() just creates a new icon that is a copy of 'icon.dmi'.
Try using icon() instead.
Try src instead of usr, try icon() instead of new /icon() (which shouldn't differ), try msrc.IconStates() instead of icon_states(msrc) (which also shouldn't differ).
In response to Kaiochao
Already had tried icon() and msrc.IconStates(), and usr != src here, so that's not an option.
Best response
Your code seems to be working fine for me. How are you creating 'anothericon'? If I just use a freshly-loaded icon object (ie var/icon/anothericon= new('icon.dmi')) then icon_states() correctly lists the newly inserted state.
In response to DarkCampainger
I was creating it through the same means. It suddenly started working for me a while ago, though, even though I didn't change one lick of code. I did restart the computer, however, though I'm not sure what could've been needed to be restarted to fix it. Strange, however, I no longer have any use for it anyhow. Problem solved anyway! Thanks for the gestures.