POV-Ray : Newsgroups : povray.general : indexing array give parse error (repost because I forget to add the subject= Server Time
1 Nov 2024 09:20:23 EDT (-0400)
  indexing array give parse error (repost because I forget to add the subject= (Message 1 to 9 of 9)  
From: stevenvh
Subject: indexing array give parse error (repost because I forget to add the subject=
Date: 15 Jan 2013 12:00:00
Message: <web.50f589f38eb9cf29209de68b0@news.povray.org>
In the code below I get an error "Parse error: Expected 'object or directive',
float function 'float identifier' found instead." The error points to the index
[i] in the assignment. Any ideas?


*** Code ****************************************************************

#declare MyTable = array[3][6] {{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0}}

#macro Init_Table()
  #local i = 0;
  #while (i < 6)
   MyTable[0][i] = i + 1
  #end
#end

Init_Table()


Post a reply to this message

From: Warp
Subject: Re: indexing array give parse error (repost because I forget to add the subject=
Date: 15 Jan 2013 12:10:52
Message: <50f58d9c@news.povray.org>
stevenvh <nomail@nomail> wrote:
>    MyTable[0][i] = i + 1

You have to #declare that.

(Also, you are not incrementing 'i' anywhere.)

-- 
                                                          - Warp


Post a reply to this message

From: stevenvh
Subject: Re: indexing array give parse error (repost because I forget to add the sub=
Date: 15 Jan 2013 12:45:01
Message: <web.50f5950f1ec80aef209de68b0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> stevenvh <nomail@nomail> wrote:
> >    MyTable[0][i] = i + 1
>
> You have to #declare that.
>
> (Also, you are not incrementing 'i' anywhere.)
>
> --
>                                                           - Warp

Thanks for the reply. The increment got lost in copying the code (I removed a
lot  of code to get to the core of the problem). I have #declared MyTable, even
with initialization values (first line of the code), and i is declared as
#local, which should be as good as #declare. Changing it to #declare doesn't
solve the problem, anyway.


Post a reply to this message

From: Warp
Subject: Re: indexing array give parse error (repost because I forget to add the sub=
Date: 15 Jan 2013 12:49:04
Message: <50f59690@news.povray.org>
stevenvh <nomail@nomail> wrote:
> Warp <war### [at] tagpovrayorg> wrote:
> > stevenvh <nomail@nomail> wrote:
> > >    MyTable[0][i] = i + 1
> >
> > You have to #declare that.
> >
> > (Also, you are not incrementing 'i' anywhere.)

> Thanks for the reply. The increment got lost in copying the code (I removed a
> lot  of code to get to the core of the problem). I have #declared MyTable, even
> with initialization values (first line of the code), and i is declared as
> #local, which should be as good as #declare. Changing it to #declare doesn't
> solve the problem, anyway.

You don't understand. You have to #declare what I quoted.

    #declare MyTable[0][i] = i + 1;

-- 
                                                          - Warp


Post a reply to this message

From: stevenvh
Subject: Re: indexing array give parse error (repost because I forget to add the sub=
Date: 15 Jan 2013 13:05:00
Message: <web.50f59946d8963828209de68b0@news.povray.org>
"stevenvh" <nomail@nomail> wrote:
> Warp <war### [at] tagpovrayorg> wrote:
> > stevenvh <nomail@nomail> wrote:
> > >    MyTable[0][i] = i + 1
> >
> > You have to #declare that.
> >
> > (Also, you are not incrementing 'i' anywhere.)
> >
> > --
> >                                                           - Warp
>
> Thanks for the reply. The increment got lost in copying the code (I removed a
> lot  of code to get to the core of the problem). I have #declared MyTable, even
> with initialization values (first line of the code), and i is declared as
> #local, which should be as good as #declare. Changing it to #declare doesn't
> solve the problem, anyway.

I thought the problem was in the array since the cursor was placed at the
position of the second index, but even with the code below I get the error. The
error points to the first i in the "i = i + 1" statement.


**** Code **********************************

#macro Init_Table()
  #declare i = 0;
  #while (i < 6)
   i = i + 1
  #end
#end

Init_Table()


Post a reply to this message

From: stevenvh
Subject: Re: indexing array give parse error (repost because I forget to add the sub=
Date: 15 Jan 2013 13:30:00
Message: <web.50f59f71d8963828209de68b0@news.povray.org>
@Warp: Oops, my bad. Thanks.


(When you're used to just ANY programming language, then programming in POV-Ray
is rather obscure, especially if you don't use it frequently. I hope version 4
will solve some of this.)


Post a reply to this message

From: Kenneth
Subject: Re: indexing array give parse error (repost because I forget to add the sub=
Date: 16 Jan 2013 00:10:01
Message: <web.50f635121ec80aefc2d977c20@news.povray.org>
I just posted some comments to the OP's original post, there; I didn't realize
it was in two places now.


Post a reply to this message

From: stevenvh
Subject: Re: indexing array give parse error (repost because I forget to add the sub=
Date: 16 Jan 2013 02:55:00
Message: <web.50f65cc7d8963828209de68b0@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> I just posted some comments to the OP's original post, there; I didn't realize
> it was in two places now.

Sorry for the double post, but in the original I forgot to fill out the subject
line. (This is supposed to be mandatory, so it should have warned me about that.
Anyway I can't edit existing posts, which is a PITA.)

Did you have a look at my proposal for a StackExchange group:

http://area51.stackexchange.com/proposals/49716/pov-ray/

StackExchange is a lot more user-friendly.


Post a reply to this message

From: James Holsenback
Subject: Re: indexing array give parse error (repost because I forget to add the sub=
Date: 16 Jan 2013 06:32:19
Message: <50f68fc3@news.povray.org>
On 01/16/2013 02:54 AM, stevenvh wrote:
> "Kenneth" <kdw### [at] gmailcom> wrote:
>> I just posted some comments to the OP's original post, there; I didn't realize
>> it was in two places now.
>
> Sorry for the double post, but in the original I forgot to fill out the subject
> line. (This is supposed to be mandatory, so it should have warned me about that.
> Anyway I can't edit existing posts, which is a PITA.)
>
> Did you have a look at my proposal for a StackExchange group:
>
> http://area51.stackexchange.com/proposals/49716/pov-ray/
>
> StackExchange is a lot more user-friendly.
>
>
Hint ... lack of response /usually/ means no interest on this forum


Post a reply to this message

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