lb wrote:
> I'm new to rebol and trying to figure out how to deal with arguments.
 I have a script file, test.r, who's sole line is:
                probe system/script/args
 
When I execute the following from within rebol
 
                do/args %test.r 10:30 %bob http://ed <http://ed>  "hello" 'whatever
 
        all I get is
 
Script: "test" (none)
10:30
== whatever
 
> Why aren't all the arguments in the probe?

        Because:
                do/args
        only requires one parameter for the argument string. Like this:

>> do/args %test.r "Hi, this is one arg"
Script: "Test" (15-Oct-1999)
"Hi, this is one arg"
== "Hi, this is one arg"

        And if you check out the help for 'do:

>> help do
Evaluates a block, file, URL, function, word, or any other value.
Arguments:
    value -- Normally a file name, URL, or block
Refinements:
    /args -- If value is a script, this will set its system/script/args
        arg -- Args passed to a script. Normally a string.

        you can see that 'do/args only requires one argument, which is
normally a string.

> Why is the last arg always echoed?

        Because you've put too many args into 'do. The result of evaluating
the last arg is returned to the command line.

> And how do you get each individual argument into a variable?

        It arrived in your script as one string. So it depends on what info
you're trying to pass. You could use 'parse to split it up. Or you
could run it through 'do, and run a mini rebol script in the passed
args. Parse is better to use though.

I hope that helps! ^_^

Andrew Martin
[EMAIL PROTECTED]
http://members.xoom.com/AndrewMartin/
Online @ 33,600 Baud!
-><-

Reply via email to