Shop OBEX P1 Docs P2 Docs Learn Events
Lookup question — Parallax Forums

Lookup question

jwa861jwa861 Posts: 1
edited 2014-02-17 08:00 in Propeller 1
Hello all,
Is there a way in spin to use a predefined array in the DAT block?

ie
repeat Index from 1 to 7
Temp:= lookup(??myArray??)
Print(Temp)

DAT
myArray byte 5, 4, 7, 1, 3, 2, 6

Thanks
Jeff

Comments

  • Tracy AllenTracy Allen Posts: 6,664
    edited 2014-02-17 08:00
    Sure,
    Within the same object use,

    tempByte := myArray[idx]

    or more generally (where @myArray can be passed between objects) use

    tempByte := byte[@myArray][idx]
Sign In or Register to comment.