POV-Ray : Newsgroups : povray.beta-test : Dictionary 'reassign' : Re: Dictionary 'reassign' Server Time
15 Jun 2021 08:12:37 EDT (-0400)
  Re: Dictionary 'reassign'  
From: clipka
Date: 4 Dec 2018 23:14:57
Message: <5c0750c1$1@news.povray.org>
Am 04.12.2018 um 16:59 schrieb ingo:
> Don't know the proper word for what I do, but the code below fails. Should
> it? Can it be made not to fail?
> 
> #declare T = dictionary {
>    ["Index"] : array[2]{"Base1", "Base2"},
>    ["Base1"] : <1,2,3>,
>    ["Base2"] : <0,1,2>
> };
> 
> #declare Chain = T["Index"][0];
> #declare Vec = T.Chain;
> 
> Parse Error: Cannot pass uninitialized identifier to non-optional LValue.

`T.Chain` is shorthand for `T["Chain"]`. You don't have a key "Chain" in 
your dictionary.

What you want is

    #declare Vec = T[Chain];

Notice the use of square brackets without quotes. This tells POV-Ray 
that the key to use is the content of the variable `Chain`.


Post a reply to this message

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