POV-Ray : Newsgroups : povray.general : how to pass array of values to a macro Server Time
6 Nov 2024 02:24:42 EST (-0500)
  how to pass array of values to a macro (Message 1 to 3 of 3)  
From: Johan Feyaerts
Subject: how to pass array of values to a macro
Date: 12 Nov 2002 12:30:06
Message: <3dd13a9e$1@news.povray.org>
Hi,

Need some help on syntax.
I 'd want to pass an array of values to a macro? Is this possible in pov
3.5? What's the syntax? How do you check how many elements are in the array
and how do you access them?
Johan Feyaerts
http://users.skynet.be/johan.feyaerts


Post a reply to this message

From: ingo
Subject: Re: how to pass array of values to a macro
Date: 12 Nov 2002 12:48:29
Message: <Xns92C4C0309A268seed7@povray.org>
in news:3dd13a9e$1@news.povray.org Johan Feyaerts wrote:

> I 'd want to pass an array of values to a macro?

#macro NumberItems(Array)
  #local Return=dimension_size(Array,1);
  (Return)  
#end

#declare Arr=array[5]{1,2,3,4,5}

#declare Num=NumberItems(Arr);

#debug str(Num,0,0)

Also look in the docs for "dimension" to figure out the amount of 
dimensions of an array.

Ingo


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: how to pass array of values to a macro
Date: 12 Nov 2002 12:49:05
Message: <3dd13f11$1@news.povray.org>
In article <3dd13a9e$1@news.povray.org> , "Johan Feyaerts" <johan_feyaerts
[at] no_spam.skynet.be> wrote:

> Need some help on syntax.
> I 'd want to pass an array of values to a macro? Is this possible in pov
> 3.5?

Declare the array, then pass it.  How to declare arrays and how to pass
declared values to a amcro is explained in the manual.  It has always been
possible sincemacros were introduced in POV-Ray 3.1.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

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