POV-Ray : Newsgroups : povray.advanced-users : Returning values through macro parameters : Re: Returning values through macro parameters Server Time
29 Jul 2024 02:23:55 EDT (-0400)
  Re: Returning values through macro parameters  
From: Mark Wagner
Date: 9 Mar 2003 23:28:15
Message: <pan.2003.03.10.04.26.51.541436.264@gte.net>
On Sun, 09 Mar 2003 05:15:02 -0500, Andrew Coppin quoth:

> Returning a value through a macro parameter isn't something I've ever
> done before. Supposing I have a macro like this:
> 
> #macro Thingy(alpha, beta)
> 
> how do I change the value of, say, beta so that it's accessible form
> outside? Do I use #declare or #local? Does it matter? The manual seems
> to imply I should use #declare (I think!) I'm a bit confused...

It's a little complicated, since it depends on how you call the macro
rather than how you write the macro.  You need to pass a declared variable
to the macro rather than a number or expression.

#macro Thingy(alpha, beta)
    #local alpha = 3;
#end

#declare A = 1;
Thingy(A, 7) /* This will change the value of A to 3 */
Thingy(A+1, 7) /* This will not change the value of A */

-- 
Mark


Post a reply to this message

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