POV-Ray : Newsgroups : povray.general : array.length()? : array.length()? Server Time
30 Jul 2024 12:19:42 EDT (-0400)
  array.length()?  
From: [GDS|Entropy]
Date: 24 Feb 2009 00:11:11
Message: <49a3816f$1@news.povray.org>
I am creating an array in one macro, and using it in another. The macro 
which creates the array surrounds it with a conditional, which results an an 
array of variable size, so when I try top loop against it (expectedly) 
subscript out of range errors occur.

This would not even be an issue were there an array.length() function.
So what I have tried to do is increment a variable within the conditional 
which populates the array which is then used within an if block just before 
the i=i+1 like this: [which forces random tests to be performed beyond your 
estimate, until your desired array length is reached]

 //     Check if required array length has been reached, if not, increment 
counter until it has
 #if (checkLength = requestedLength-1)
  #debug "Required Array Length Reached, now exiting... \n"
 #else
  #if (ctr > 5000)
   #debug "Ceiling has been reached; Preventing infinite loop, now 
exiting... \n"
  #else
   #set ctr=ctr+1;
  #end
 #end

Is this the best I can hope for? Is there some other way to detect the 
populated length of an array? dimension_size is *useless*. Might it be that 
I am forced to form the array within the loop which uses it? That would 
suck...not very OO...but then SDL isn't very OO to start with, ironically..

ian


Post a reply to this message

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