MOO-cows Mailing List Archive
[Prev][Next][Index][Thread]
RE: Wierd Verb Stuff - Need Help!
-
Date: Sat, 27 Jan 1996 12:55:30 PST
-
From: Ron Stanions <chaeon@roc.clawpaw.com>
-
Content-Transfer-Encoding: 7bit
-
Content-Type: text/plain; charset="us-ascii"
You're close, but not close enough. :)
What you want to do is to wrap the verbname in parenthesis, like so:
cmd = "foo";
player:(cmd)();
This will call player:foo()
and changing cmd to "bar" will cause it to call player:bar()
This also works with properties, and this is also how you must do it when calling
verbs (or accessing properties) with special characters in it, such as
"@list".
----------
From: Chris Jones[SMTP:cjones@freenet.edmonton.ab.ca]
Sent: Saturday, January 27, 1996 3:35 PM
To: moo-cows
Subject: Wierd Verb Stuff - Need Help!
Hi, everyone. I'm trying to setup a verb on an object which
works like this:
[Verb code may not work; making this off the top of my head]
cmd = "foo";
player:cmd();
[Could this be setup so that the second line will execute player:foo(),
and then if cmd is changed (say to "bar"), that it would execute
player:bar()?]
I've though of a few ways, but they're not really elegant, and
would waste server ticks:
[Example]
cmd = "foo";
if (cmd == "foo")
player:foo();
elseif (cmd == "bar")
player:bar();
endif
[end verb code]
Any ideas?
/--------------------v- PGP Fingerprint --------------------------------\
|42 -It's the answer!| 95 2F 8F 26 F9 CA 4B 1A D1 CA C1 5E F9 76 59 AB |
\--------------------^--------------------------------------------------/
Home |
Subject Index |
Thread Index