POV-Ray : Newsgroups : povray.general : Parameters to functions used in expressions ... : Parameters to functions used in expressions ... Server Time
2 Aug 2024 04:18:34 EDT (-0400)
  Parameters to functions used in expressions ...  
From: Neil Kolban
Date: 18 Jan 2005 23:41:49
Message: <41ede50d@news.povray.org>
Folks,

I am still learning functions ... I wanted to create something like:

#declare foo = function(a,b,c) {
   #if (a>0.0)
      #declare a=a+1;
   #end
a+b+c
}

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.  When I try and run this, I get:

-----

File: C:\Documents and Settings\kolban\My Documents\My 
3D\Projects\Tiles\test.inc  Line: 2
#declare foo = function(a,b,c) {

#if (a <----ERROR

Parse Error: Expected 'numeric expression', undeclared identifier 'a' found 
instead

Returned from renderer with error status

-----

Am I not allowed to use function parameters in the conditionals within my 
function body?

Neil


Post a reply to this message

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