ID:150992
 
Concerning the sample code from DM Reference under List Associations:
var/params[]

params["player"] = "James Byond"
params["score"] = 2000


This doesn't work for me in an object's definition. I get the following error:

error:params:left-hand side must be an object variable

So what am I not getting here?
params["player"] = "James Byond"
params["score"] = 2000

This doesn't work for me in an object's definition. I get the following error:

error:params:left-hand side must be an object variable

So what am I not getting here?

I'm not sure if you can do that in an object definition. Try declaring params, and setting the "player" and "score" in New().
On 6/10/01 12:25 am Skysaw wrote:

You can only initialize a list in this fashion from inside a proc. The example also has an error, btw, because params[] is never pointed to a valid list. Try this:

obj
var/list/params
New()
params = list()
params["player"] = "James Byond"
...

which is the notation I prefer, or you can use Dan's shorthand:

obj
var/params[0]
New()
params["player"] = "James Byond"
All fixed now. Thanks for your quick responses!