POV-Ray : Newsgroups : povray.newusers : arrays Server Time
4 Nov 2024 21:24:32 EST (-0500)
  arrays (Message 1 to 2 of 2)  
From: Ross Litscher
Subject: arrays
Date: 21 Jan 2003 22:35:04
Message: <3e2e1168$1@news.povray.org>
allright, i don't know what i'm doing. i'll start off simple, here's my
array declaration:

#declare r1 = seed(8282);
#declare p_count = 4;
#declare v_array = array[p_count] {
  0, 0, 0, 0
}

this was a compromise, as i didn't want to initialize the items in the array
this soon. the next bit of code was going to do that.

#declare counter = p_count - 1;
  #while (counter >= 0)

    v_array[counter] = 2*rand(r1);  /* error here*/
  /*... some other stuff */
  #end

i get the error "Expected 'object or directive', float function 'float
identifier' found instead".



what i really want to do is initialize all the array elements in a loop:

#declare r1 = seed(8282);
#declare p_count = 4;
#declare v_array = array[p_count];
#declare counter = p_count - 1;
  #while (counter >= 0)

    v_array[counter] = 2*rand(r1);  /* get a different error now */
  /*... some other stuff */
  #end

at which point i get "Attempt to access uninitialized array element," on the
same line. so what in the holy name of POV-Ray am i doing wrong in either
case?

smack me silly, hit some sense into me.
ross


Post a reply to this message

From: Ross Litscher
Subject: Re: arrays
Date: 21 Jan 2003 22:51:08
Message: <3e2e152c$1@news.povray.org>
ignore all that.. i forgot that pov needs a #declare in there...
thanks for reading if you did, anyway.


peas,
ross


Post a reply to this message

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