Shop OBEX P1 Docs P2 Docs Learn Events
array help — Parallax Forums

array help

Zap-oZap-o Posts: 452
edited 2009-09-02 17:36 in Propeller 1
Is there a clever way to move data from one array to another. Say I have a array named X [noparse][[/noparse] 30 ] and an array named y [noparse][[/noparse] 30 ] I want to copy all the data from x [noparse][[/noparse] 2 ] to x [noparse][[/noparse] 30 ] into Y [noparse][[/noparse]0 ] to y [noparse][[/noparse] 28 ]. I cant seem to get my head around a good solution.

Comments

  • TimmooreTimmoore Posts: 1,031
    edited 2009-09-02 17:07
    assuming x and y are longs

    longmove(@y, @x, 29)
  • Zap-oZap-o Posts: 452
    edited 2009-09-02 17:23
    I suppose i was trying to think of a better / another way yo do this

    
    F := 0 
    Repeat F from 0 to idx
              Y[noparse][[/noparse] F ] := X[noparse][[/noparse] F+2 ]
    
    



    Thanks for the information.
  • ericballericball Posts: 774
    edited 2009-09-02 17:32
    longmove( @Y + ystart << 2, @X + xstart << 2, (yend - ystart #> xend - xstart) + 1 )

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Composite NTSC sprite driver: Forum
    NTSC & PAL driver templates: ObEx Forum
    OnePinTVText driver: ObEx Forum


    Post Edited (ericball) : 9/2/2009 11:41:23 PM GMT
  • TimmooreTimmoore Posts: 1,031
    edited 2009-09-02 17:36
    If x and y are defined in the same file then

    longmove(@y [noparse][[/noparse] 2 ], @x, 29)
    
    


    works, otherwise you have to multiple the 2 by 4 to translate for long.
Sign In or Register to comment.