ID:114506
 
Resolved
When image() was called with an icon state as the second argument instead of a loc, and this was followed by named arguments (e.g., image('icon.dmi', "state", layer=5)), the named arguments were replaced by garbage data.
BYOND Version:485
Operating System:Windows XP Home
Web Browser:Firefox 4.0.1
Applies to:Dream Seeker
Status: Resolved (486)

This issue has been resolved.
Descriptive Problem Summary:
It seems image() loses its layer attribute.

Code Snippet (if applicable) to Reproduce Problem:
var/image/I=image('icon.dmi',"icon_state",layer=5) 
world<<I.layer

Expected Results:
It should output 5.

Actual Results:
It outputs -1.

When does the problem NOT occur?
That snippet seems to output the correct layer when not defining an icon.

Workarounds:
var/image/I=image('icon.dmi',"icon_state") 
I.layer=5
world<<I.layer
The second argument to image() is a location for the image not the icon_state. That seems to be messing things up for you. Doing this will correctly output 5 for the layer:

var/image/I=image('icon.dmi',null,"icon_state",layer=5)


or
var/image/I=image('icon.dmi',icon_state="icon_state",layer=5)
Which is odd since declaring "layer=5" rather than just "5" should work just fine.
mob
verb
hurp()
derp(b=5)
proc
derp(a,b)
world<<"[a],[b]"
//This will output ",5"
I found the issue. When the second arg is a string, the code tries to shift over all the positional arguments. It does so by copying them, but it was not copying the arguments from the first named argument forward. As a result, nonsense data was ending up in there.