comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: exposing variables to higher program levels
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: exposing variables to higher program levels [message #54065] Thu, 17 May 2007 04:41 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Lasse Clausen writes:

> So I tried:
>
> pro example2
> example
> print, haha
> end
>
> pro example
> void = scope_varfetch('haha', /enter, level=-1)
> void = 'Hello'
> end
>
> But alas!:
> IDL> example2
> IDL: Variable is undefined: <No name>.
> IDL: Execution halted at: EXAMPLE 7 /home/lbnc1/idl/
> example.pro
> IDL: EXAMPLE2 2 /home/lbnc1/idl/
> example.pro
> IDL: $MAIN$
>
>
> What am I doing wrong? Is that not exactly, what Chris wants?

You need to read that article again:

http://www.dfanning.com/tips/access_main_vars.html

Here is code (written with proper naming convention, BTW) that
works:

pro example
(scope_varfetch('haha', /enter, level=-1)) = 'Hello'
end

pro example2
example
print, haha
end

And then,

IDL> example2
Hello

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Read values from a table with IDL - narrowed-down question
Next Topic: Re: Defining IDL structures given variable type, width and precision

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 14:44:08 PDT 2025

Total time taken to generate the page: 1.09468 seconds