POV-Ray : Newsgroups : povray.general : Serializing a dictionary : Re: Serializing a dictionary Server Time
13 Jul 2025 12:34:57 EDT (-0400)
  Re: Serializing a dictionary  
From: William F Pokorny
Date: 6 Jul 2025 01:47:39
Message: <686a0dfb$1@news.povray.org>
On 7/5/25 21:42, Josh English wrote:
> And I'm getting an error:
> 
> Parse Error: Can't nest directives accessing the same file.

You are missing a couple of closing parens.

#macro WriteTileSet(fname)
   #fopen TILE fname write
   #for(I, 0, MaxEntropy-1, 1)
     #write (TILE, "#declare TileSet[", S(I), "] = dictionary {\n")
     #write (TILE, "  .name = ", TileSet[I].name, ";\n")
     #write (TILE, "  .edges = array[", S(TileEdges),"] {"    // <--
     #for(E, 0, TileEdges-1, 1)
       #write (TILE, TileSet[I].edges[E], ", ")
     #end
     #write (TILE, "};\n")
     #write (TILE, "  .pidx = ", S(TileSet[I].pidx),";\n")
     #write (TILE, "  .rot = ", S(TileSet[I].rot), ";\n")
     #write (TILE, "}\n"                                      // <---
   #end // for I

   #fclose TILE
#end

The parser is seeing another #write directive start, while being in the 
middle of parsing a prior #write directive. As long as the .edges 
element is a string, you should be on your way after adding the closing 
parens.

Bill P.


Post a reply to this message

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