| Author |
Message |
Antimon

Joined: Jan 18, 2005 Posts: 4145 Location: Sweden
Audio files: 373
G2 patch files: 100
|
Posted: Thu May 21, 2009 2:39 am Post subject:
Command line arguments to the VM |
 |
|
I feel kind of stupid here, but if you don't ask you'll never know...
A lot of the examples (e.g. gomidi.ck) have lines like this:
| Code: | | if( me.args() ) me.arg(0) => Std.atoi => device; |
which I interpret as reading an argument that the user provides when running the VM. Thinking I should make a hack a bit more user friendly before submitting to the monome forum, I wanted the user to be able to add such an argument when running my chuck program. And sure, I can add a line like the one above, but I have no idea how I am supposed to set this argument when running the chuck program!
I have browsed the ChucK docs up and down, and searched around a bit here, but I'm damned if I can find example where someone runs chuck with application arguments. Is this only supported in the MiniAudicle? Is there a text here right under my nose that says how it works?
and, just to be clear, this doesn't work:
this will output:
| Code: | | [hej]: no such file or directory |
because chuck assumes that hej is a chuck source file that I want to run.
I'm running on OSX, can that be the issue?
/Stefan _________________ Antimon's Window
@soundcloud @Flattr home - you can't explain music |
|
|
Back to top
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Thu May 21, 2009 3:06 am Post subject:
Re: Command line arguments to the VM |
 |
|
| Antimon wrote: | | I'm wise enough to ask questions; if you don't ask you'll never know... |
Fixed a typo there. :¬p
| Quote: |
I have browsed the ChucK docs up and down, and searched around a bit here, but I'm damned if I can find example where someone runs chuck with application arguments. |
Oh, yes, that's underdocumented and should be in the VM commandline options reference, I feel. Right now I think it might only be documented in the VERSIONS text and maybe a example. Let me quote from VERSIONS;
| Quote: |
1.2.0.8
- (added) command line argument support
e.g. %> chuck foo.ck:1:hello bar:2.5:"with space"
also works with OTF commands
e.g. %> chuck + foo:1:yo
also works with Machine.add( ... )
e.g. // code
Machine.add( "foo:1:2:yo" );
(see examples/basic/args.ck for accessing from code) |
Does that clarify? _________________ Kassen |
|
|
Back to top
|
|
 |
Antimon

Joined: Jan 18, 2005 Posts: 4145 Location: Sweden
Audio files: 373
G2 patch files: 100
|
Posted: Thu May 21, 2009 3:27 am Post subject:
|
 |
|
He he Perfect, thanks! That syntax makes sense, so it can be used with Machine.add() also.
I think this info would fit in the VM options page, or in the "Running ChucK" section in the language spec.
/Stefan _________________ Antimon's Window
@soundcloud @Flattr home - you can't explain music |
|
|
Back to top
|
|
 |
|