POV-Ray : Newsgroups : povray.general : Serializing a dictionary : Re: Serializing a dictionary Server Time
13 Jul 2025 12:28:59 EDT (-0400)
  Re: Serializing a dictionary  
From: Josh English
Date: 6 Jul 2025 15:51:00
Message: <686ad3a4$1@news.povray.org>
On 7/5/2025 9:05 PM, jr wrote:
> hi,
> 
> Josh English <Jos### [at] joshuarenglishcom> wrote:
>> I have a dictionary in 3.8 and one of the elements is an array.
>> ...
>> 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?
> 
> I've been looking at (un)serialising dictionaries using my 'Filed()' macro[*],
> and have not yet found a "good way" for dealing with arrays, especially
> multi-dimensional.  I think converting the array to a string, and storing that,
> will work, eg "3.1415:1.23:0.1" for an array of three floats; have a look at my
> 'strSplit()' macro[**] for the unserialising.
> 
> [*] <wiki.povray.org/content/User:Jr>
> [**] <news.povray.org/web.64b08576d08f3556b49d80446cde94f1%40news.povray.org>
> 
> 
> regards, jr.
> 

I'll look into it. I've found it's generally easier just to build an 
include file that can be imported later than trying to manage 
customizing serialization.

Now if POV-Ray 4.0 could read and write JSON or XML, I'd be in heaven, 
but I don't think that's in the plans.

Uncle Josh


Post a reply to this message

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