From: Chris Bailey Date: 2008-08-29T06:12:29+09:00 Subject: Re: Use a string as a method call Thomas B. wrote: > Chris Bailey wrote: >> send $cmd_list[input] > >> cmd_list = { >> 'north' => 'do_north' >> 'south' => 'do_south' >> 'n' => 'do_north' >> 's' => 'do_south' >> 'look' => 'do_look' >> } > The variable names don't agree but I suppose it's a typo in the post? > > Well, what are you trying to do? If you want to increment or decrement > $PLROBJ.xcoord, you must say $PLROBJ.xcoord+=1 or $PLROBJ.xcoord-=1. > What happens now, the variable $PLROBJ.xcoord is incremented or > decremented by the result of showMap, like in $PLROBJ.xcoord-=showMap(), > and showMap probably returns nil. > > TPR Arg! The variable mismatch was a typo, and the error is because I was using += instead of +=1. Dumb mistake on my part. Yesterday I was trying to use ++ Thanks -- Posted via http://www.ruby-forum.com/.