POV-Ray : Newsgroups : povray.newusers : arrays : arrays Server Time
31 Jul 2024 04:19:01 EDT (-0400)
  arrays  
From: Ross Litscher
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

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