POV-Ray : Newsgroups : povray.general : Global variable changed by Macro without parameters? : Re: Global variable changed by Macro without parameters? Server Time
5 Nov 2024 13:26:36 EST (-0500)
  Re: Global variable changed by Macro without parameters?  
From: Tim Nikias v2 0
Date: 2 Apr 2003 06:41:51
Message: <3e8acc7f@news.povray.org>
Its more like:

#macro Init()
 #declare Test=1;
#end

#macro Incremenent()
 #local Var=Test;
 #local Var=Var+1;
 #declare Test=Var;
#end

Init()
Incremenent()

No declaration of Test before. Thats
why I'd think that declaring Test inside
Increment() should access the Test
variable and overwrite it.
Or am I mistaken?

--
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: Tim### [at] gmxde

>
>
> "Tim Nikias v2.0" wrote:
> >
> > This is what I'm trying to do:
> > I want global variables, that are affected
> > by macros, without handing the variables
> > as parameters to the macro.
> > To do this, I #declare a variable with
> > the same name as the global, thus hoping to
> > overwrite it. Does that work?
> >
> > [...]
>
> Try:
>
> #declare Test=1;
>
> #macro Macro()
>   #declare Test=2;
> #end
>
> Macro()
>
> #debug str(Test,0,0)
>
>
> Christoph
>
> --
> POV-Ray tutorials, include files, Sim-POV,
> HCR-Edit and more: http://www.tu-bs.de/~y0013390/
> Last updated 28 Feb. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.