POV-Ray : Newsgroups : povray.advanced-users : Problems with using variables and nested macro scope - How to code? Server Time
28 Mar 2024 14:17:16 EDT (-0400)
  Problems with using variables and nested macro scope - How to code? (Message 1 to 1 of 1)  
From: Bald Eagle
Subject: Problems with using variables and nested macro scope - How to code?
Date: 8 Mar 2016 11:15:01
Message: <web.56defa74196aab175e7df57c0@news.povray.org>
I want to globally declare a variable for use as a flag in a .pov file that
includes a macro.

The macro must obviously check to see if that variable is defined, otherwise it
whines about an undefined variable when I try to check its value with an if
statement.
To head off problems, I do an ifndef(var) #local var=false #end

The problem is that there's another macro nested in the called macro.

How exactly do I declare var locally (to the main .pov file) but "globally" so
that it's recognized by the sub-macro?

Is there a proper way to do this, or do I need to declare it globally and then
undef it when I pop out of the macro?   That just seemed kludgy to me.


Post a reply to this message

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