POV-Ray : Newsgroups : povray.general : Parameters to functions used in expressions ... : Re: Parameters to functions used in expressions ... Server Time
2 Aug 2024 04:25:29 EDT (-0400)
  Re: Parameters to functions used in expressions ...  
From: Vincent LE CHEVALIER
Date: 19 Jan 2005 03:33:31
Message: <41ee1b5b$1@news.povray.org>
Slime wrote:
>>My problem seems to be that the formal parameters supplied to the function
>>don't seem to be in scope for the expressions.  It is as thought they were
>>not declared.
> 
> 
> They aren't. Commands beginning with # are evaluated at parse time in order
> to get the tokens which are used to generate the objects they surround: in
> this case, the function. So as the # commands are evaluated, the function
> doesn't exist yet, and once the function is finished being created, the #
> commands are already taken care of and are never seen again.
> 

Do arrays work in the same way ? I recall having tried to get a value in 
an array, indexed by a parameter of a function (something like 
function(x) {myarray[floor(x)]} ) and never being able to find a way to 
do so...

-- 
Vincent


Post a reply to this message

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