[DGD]mappings, use of.

MUD Account mud at hal9000.hal9000.net.au
Wed Apr 14 09:47:14 CEST 1999


Yeah Im afraid its me again.  I need something cleared up.
According to an LPC tutorial I have you can get the
value of a mapping by doing the following:
mapping test;

test=(["smile":"$N $vsmile.", "grin":"$N $vgrin.");

Now according to their examples I should be able to get
"$N $vsmile." by doing the following:
test["smile"];
Or if I had a string called "command" for example and it
contained "smile":
string command;

command = "smile";
test[command] should return "$N $vsmile." as well...
Instead I get the error message:
Index on bad type

There must be something really obvious to the rest of you as
to what Im missing.  Ive been staring at this the past hour and
cant for the life of me see what Im missing.
I thought I would try and use mappings erm properly for a change
instead of treating it like an array when Im searching for something.
ie. using map_sizeof(test) then using a for next loop to go through it.
Why?  I have no idea - just found some code I wrote late one night
that I used it on for some reason :)

Anyway I apologise for asking what must be a simple question also Id
like to thank Dworkin for answering my question on compiling DGD
on MSVC 5.0, which I think I may have asked before :P  Pity I lost
all my mail archives..

I blame my current bout of stupidity on a vicious bout of the flu :)

|- mud at hal9000.net.au -|oOoOoOoOoOoOoOoOoOoOoOoOoOoOo...............

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list