|
 |
I have a dictionary in 3.8 and one of the elements is an array.
I'm trying to write the definitions out to a text file:
#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
And I'm getting an error:
Parse Error: Can't nest directives accessing the same file.
Is there a way around this? I don't want to have to manually write each
element out.
I think it requires another macro to convert the .edges element to a
string that I can then slap into the #write directive. Is this the only
way or am I missing something?
Uncle Josh
Josh
Post a reply to this message
|
 |