Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / (How) Can I use a variable with a CALL

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. (How) Can I use a variable with a CALL
#5655
Posted by: 2004-12-30 18:34:38 Last edited by: Jeff Glatt 2007-07-13 00:15:01 (Total edited 1 time)
xx = "wimbledon_100"
CALL xx
returns 'Could not find routine "XX" '

Is it possible to use a variable with a CALL?

I'm trying to call a child script whose location I may not know before my main script runs. Assume that the child script is named child.rex, and happens to be in the same directory as the main script:
child.rex()
...works fine, if child.rex resides in the same directory. If not, I get an error message. How do I specify the directory where the child script is?
Message2. Re: (How) Can I use a variable with a CALL
#5659
Posted by: Jeff Glatt 2004-12-31 00:54:01 Last edited by: Jeff Glatt 2007-07-13 00:17:16 (Total edited 1 time)
You can't put the name of a variable after the CALL keyword. CALL doesn't allow that. CALL regards any name as a literal string, even if it isn't quoted.

To allow variable substitution. Reginald allows you to use brackets to indicate the same, ie:
myvariable = "blort"
/* Call the function named "blort" */
CALL [myvariable]
But this doesn't work for other interpreters, so you'd have to resort to the slower:
INTERPRET "CALL" myvariable
Incidentally, if you know the full path to the script beforehand, you can hardcode it right in your call instruction, but do quote it as so:
"C:\MyDir\MySubDir\child.rex"()
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2024-4-27  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0