[REBOL] Re: Series of objects
From: greggirwin:mindspring at: 22-Aug-2003 9:38
Welcome to REBOL Matt!
MM> I have a series of connections calles clients, what I want to do is find a
MM> particular one of those connections, with index i, and change the user name
MM> etc.
MM> In C or other languages it would be somewhat in the form:
MM> clients[i].user = "Bob"
MM> I'm trying to use a command like: clients/i/user: "Bob" but REBOL tries to
MM> look for a path named i rather than the ith element. Any pointers? BTW I
MM> am very new to REBOL and I'm sure this is an easy problem
It's simple, but not obvious. :) You need to prepend a colon to the
word you want REBOL to "dereference".
clients: [Joe Bob Sue Sandra]
repeat i length? clients [
print clients/:i
]
clients: [
[id #001 user Joe]
[id #002 user Sue]
]
repeat i length? clients [
print [clients/:i/id clients/:i/user]
]
This mailing list is perhaps the best resource for REBOL. Great folks
here.
Happy REBOLing!
-- Gregg