MOO-cows Mailing List Archive
[Prev][Next][Index][Thread]
Re: a programming prob.
-
Date: Tue, 13 Feb 1996 21:55:06 PST
-
From: Kipp the Kidd <mcmudge@mailbox.syr.edu>
-
Content-Type: text/plain; charset="us-ascii"
>I was wondering if anyone here could help me out. say I had a property
>that looked like this...
>
>OBJECT.PROP = {"foo", {"bar", {"hello", "there"},
> "qwerty", {"quaz", {"poi", {"moo", "cows"}}}}};
>
>and I had a verb that would return the numbers...
> {2, 4, 2, 2, 1}
>
>so OBJECT.PROP[2][4][2][2][1] would be "moo".
>How would I get another verb to find "moo" using those numbers without
>always having to have the same amount of numbers?
The 1.7.9 verb would read:
return this:(verb)(args[1][(e=args[2])[1]],e[2..length(e)]);
Or, the easier 1.8.0:
return this:(verb)(args[1][(e=args[2])[1]],e[2..$]);
So, if you call it;
obj:verb({"foo", {"bar", {"hello", "there"}, "qwerty", {"quaz", {"poi",
{"moo", "cows"}}}}},{2, 4, 2, 2, 1})
It will return "moo"
- Kipp
PS. I didn't test this. I went over it in my head... so if it doesn't work,
don't bug me :)
-----BEGIN GEEK CODE BLOCK-----
GCS/CC d- s+:- a16 C++ UL++++ P+ L++ E-? W+ !N--@ !o-- K->K++++++
w++(--) O- M-- V--? PS++(+) PE(--) Y+ PGP-? t+ 5(+) X++ R+++(*)
!tv b+ DI++++ D++++ G e* h!()(*) r+ !y+
------END GEEK CODE BLOCK------
-----BEGIN NOT SO GEEKY BLOCK-----
MOO projects:
RPG Minimal.db: paradigm.microwave.com 5000
MOO2000: moo.microwave.com 2000
MundoHispano: europa.syr.edu 8888
------END NOT SO GEEKY BLOCK------
Home |
Subject Index |
Thread Index