You can access Main Level Variables!!! [message #18584] |
Wed, 19 January 2000 00:00  |
Michael Lefsky
Messages: 9 Registered: October 1999
|
Junior Member |
|
|
So it turns out you can access main level variables- try this
create this function:
function fetch,string
var=routine_names(/fetch,string)
help,var
return,var
end
then
dummy="hello"
print,fetch("dummy")
VAR STRING = 'hello'
hello
So one could do what I want- create a new "foolproof" save command. Now
if we just had a way of executing statements as if they were type at the
main level.
Michael Lefsky, PhD
Research Ecologist
U.S. Forest Service
Forest Sciences Laboratory
Corvallis, OR
lefsky@fsl.orst.edu
http://www.fsl.orst.edu/~lefsky
|
|
|
Re: You can access Main Level Variables!!! [message #18655 is a reply to message #18584] |
Sun, 23 January 2000 00:00  |
gross
Messages: 3 Registered: December 1999
|
Junior Member |
|
|
I think you can....
try using "EXPR=", as in..
expr='make_some_var_name_here=do_this_operation'
ret=execute(expr)
note that what happens is that whatever you have after expr= gets
dumped to the command line as if you were typing it...I typically use
this method to create a series of arrays such as im1,im2,im3...,etc.
On Wed, 19 Jan 2000 12:39:43 -0800, Michael Lefsky
<lefsky@fsl.orst.edu> wrote:
> So it turns out you can access main level variables- try this
>
> create this function:
>
> function fetch,string
> var=routine_names(/fetch,string)
> help,var
> return,var
> end
>
> then
>
> dummy="hello"
>
> print,fetch("dummy")
> VAR STRING = 'hello'
> hello
>
> So one could do what I want- create a new "foolproof" save command. Now
> if we just had a way of executing statements as if they were type at the
> main level.
>
> Michael Lefsky, PhD
>
> Research Ecologist
> U.S. Forest Service
> Forest Sciences Laboratory
> Corvallis, OR
> lefsky@fsl.orst.edu
> http://www.fsl.orst.edu/~lefsky
>
>
|
|
|