POV-Ray : Newsgroups : povray.advanced-users : passing variable to macro for use in #for statement : Re: passing variable to macro for use in #for statement Server Time
26 Apr 2024 02:18:32 EDT (-0400)
  Re: passing variable to macro for use in #for statement  
From: clipka
Date: 20 Sep 2018 11:00:09
Message: <5ba3b5f9$1@news.povray.org>
Am 20.09.2018 um 16:09 schrieb Bald Eagle:

> Though I'm trying to only /initiate/ a loop with the macro - so the #end of the
> for loop is what I need to avoid at the present.
> I have not yet figured out if there's a syntax trick that's possible.

Can't do such a thing. The `#end` directives in a macro must always be
balanced - otherwise, how would the parser be able to figure out where
the macro ends.


>>     #declare Format = "png";
>>     image_map { FormatKeyword(Format) "foo.png" }
> 
> Right - o.  That'll be great.   Especially since I can just use a string
> function to look at the extension of the filename and avoid the declare
> altogether.   :)

If the file type can already be inferred from the extension, Why not let
POV-Ray do that job? Just leave out the file format keyword, like so:

    image_map { "foo.png" }

and Bob's your uncle.


Post a reply to this message

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