Shop OBEX P1 Docs P2 Docs Learn Events
Array Handling Difficulties — Parallax Forums

Array Handling Difficulties

william chanwilliam chan Posts: 1,326
edited 2009-01-19 12:52 in Propeller 1
Help!

I tried doing

VAR
long mydata[noparse][[/noparse]20]

index := 1
third := 3
mydata[noparse][[/noparse]index].byte[noparse][[/noparse]third] := 100

but the compiler keeps complaining "variable needs a parameter"....

What gives?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my

Comments

  • Erik FriesenErik Friesen Posts: 1,071
    edited 2009-01-19 03:33
    You will have to do it this way.

    mydata.byte[noparse][[/noparse](index*4)+third]
    
  • william chanwilliam chan Posts: 1,326
    edited 2009-01-19 03:57
    I thought the most logical and clean way would be my example code.
    This is most unusual.

    Thanks for your help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.fd.com.my
    www.mercedes.com.my
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-01-19 04:25
    William,

    I can't disagree. A subscripted variable should still produce a typed "lvalue" on the compile stack that's subject to further modification. It's probably not a bug in the compiler, but more likely just an oversight.

    -Phil
  • Erik FriesenErik Friesen Posts: 1,071
    edited 2009-01-19 12:52
    I have smacked my head into this one too. I think I have tried every possible combination. I'd agree with phil.
Sign In or Register to comment.