in news:web.443d560fde047fad6c4803960@news.povray.org Trevor G Quayle
wrote:
> also, the macro could be rearranged to keep the error check as:
>
#macro Rand_Array_Item(Array, Stream)
#if(dimensions(Array)=1)
#local Return = Array[floor(rand(Stream)*0.9999999*dimension_size
(Array,1))];
#else
#error "The Rand_Array_Item() macro only works for 1D arrays."
#end
Return
#end
I've ran so often into this problem that I use the above more or less as
a standard solution now.
I wouldn't mind if a #return statement became part of the SDL in a
(near) future version. And for the error handling a #try #except #else
#finally would also be nice for a (not so near) future version.
Ingo
Post a reply to this message
|