POV-Ray : Newsgroups : povray.general : #local access : Re: #local access Server Time
8 Aug 2024 04:08:32 EDT (-0400)
  Re: #local access  
From: Ron Parker
Date: 1 Mar 2001 16:26:36
Message: <slrn99tfke.vj6.ron.parker@fwi.com>
On Thu, 1 Mar 2001 22:04:36 +0100, Rune wrote:
>   #local Var = Var+1; // line 7
              ^ When the parser gets here, it sees that you're declaring a
local and has created a space to put that local in.  It called that space 
"Var".

>   #local Var = Var+1; // line 7
                    ^ When it gets here, it sees that you are trying to use
a variable called "Var" which it goes and looks up.  It finds the one you're
currently creating and returns an error because it hasn't been defined yet.

Presumably this could be changed to work the way you expect, but I'd hesitate
to call it a bug.

>On an unrelated note: Isn't there any way I can make the child macro handle
>and update a variable created in the mother macro, besides making the
>variable global? I'm afraid not?

Pass the variable in as a parameter.  POV 3.1g treats parameters as references 
when you pass identifiers, unless they're strings (that last part is a bug.)

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

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