[REBOL] returning an object from a function, sort of
From: zoon::stumpworld::com at: 17-Aug-2000 11:36
hiall
btw, I sent a message almost identical to this one from my home account last
night, and it isn't here. Is it because the list doesn't rec that other account?
anyway...
I've got a function called logo-factory that accepts a string argument, and
should return an object referenced by a word = the passed string. ie., if I type
*logo-factory Logo1*
I should get the same result as if I typed
*Logo1: make object! [....]*
I'm befuddled as to how to do this exactly -- I'm sure the answer is right under
my nose ;-)
Here's sort of what I have so far:
*
logo-factory: func [
"Creates and returns a named logo object."
name [string!] "The name of the object to be created."
][
????? make object! [
type: "text"
text: ""
pict: #{}
file: ""
altt: ""
switch-type: func [
"Toggles the logo object's type between 'text' and 'pict'."
][
type: either type = "text" ["pict"]["text"]
]
]
]
*
Obviously, there's a lot missing here, like handling an argument string which
can't be used as a valid word, etc. Other functions like get-pict and
write-html, etc., also need to be added.
Any and all suggestions are welcome!
--
Pete Wason|"LWATPLOTG"|[zoon--stumpworld--c]|[mrzoon--hynoom--c]|CUCUG|TA|PHX