POV-Ray : Newsgroups : povray.beta-test : check type of variable Server Time
26 Dec 2024 07:25:32 EST (-0500)
  check type of variable (Message 1 to 3 of 3)  
From: ingo
Subject: check type of variable
Date: 5 Dec 2018 14:39:10
Message: <XnsA9AFD21809B85seed7@news.povray.org>
When I do it wrong POV-Ray always tells me that it for example expects a 
string instead of an arry.

Is there a way to check the type of a variable? Is especially interesting 
now arrays can hold different types. Also gives the possibility to declare 
a single instead of declaring a whole array for a single item, when inost 
cases for a macro a single value suffices.

If not, read it as a feature request.
#if (type(Var)=String)
    	...
#end

Ingo


Post a reply to this message

From: clipka
Subject: Re: check type of variable
Date: 5 Dec 2018 22:32:37
Message: <5c089855$1@news.povray.org>
Am 05.12.2018 um 20:39 schrieb ingo:
> When I do it wrong POV-Ray always tells me that it for example expects a
> string instead of an arry.
> 
> Is there a way to check the type of a variable? Is especially interesting
> now arrays can hold different types. Also gives the possibility to declare
> a single instead of declaring a whole array for a single item, when inost
> cases for a macro a single value suffices.
> 
> If not, read it as a feature request.
> #if (type(Var)=String)
>      	...
> #end

MegaPOV had such a feature. Official POV-Ray doesn't.


Post a reply to this message

From: ingo
Subject: Re: check type of variable
Date: 6 Dec 2018 02:03:55
Message: <XnsA9B0520C4420seed7@news.povray.org>
in news:5c089855$1@news.povray.org clipka wrote:

>> If not, read it as a feature request.
>> #if (type(Var)=String)
>>           ...
>> #end
> 
> MegaPOV had such a feature. Official POV-Ray doesn't.

Ah yes, #declare Identifier=is ( IDENTIFIER , TYPE | SUBTYPE );

I guess this feature is probably not high on the transplantation list.


ingo


Post a reply to this message

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