Results 1 to 5 of 5

Thread: STAT_CLONEARRAY and UDT

  1. #1

    Question STAT_CLONEARRAY and UDT

    Click image for larger version. 

Name:	Capture2.JPG 
Views:	56 
Size:	52.1 KB 
ID:	10083

    STAT_CLONEARRAY and UDT , aren't they compatible ?
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10
    No, I'm sorry
    It works only on numeric arrays

    In general STAT module was intended to work with numeric arrays
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,089
    Blog Entries
    5
    Rep Power
    725
    Hi Sebastian,

    I think you can perform duplicate for example this way:
    uses "Console"
    
    type Vector3D
      x as float32
      y as float32
    end type
    
    dim arr(3) as Vector3D
    dim arr_copy(3) as Vector3D
    
    int32 i
    
    for i = 1 to ubound(arr)
      arr(i).x = i
      arr(i).y = i
    next
    
    ' This is like "copy bytes from start of the array, of total length calculated like number-of-elements * size-of-element and store them to string"
    ' VarPtr is "variable pointer"
    string binary = peek$(varptr(arr(1)), CountOf(arr(1))*SizeOf(arr(1)))
    
    ' This is like - "paste the binary string at place starting at beginning of arr_copy"
    poke$(varptr(arr_copy(1)), binary)
    
    printl "Source array:"
    for i = 1 to ubound(arr)
      printl arr(i).x, arr(i).y
    next
    
    
    printl
    
    
    printl "Copied array:"
    for i = 1 to ubound(arr)
      printl arr_copy(i).x, arr_copy(i).y
    next
    
    
    waitkey
    

    Petr
    Last edited by Petr Schreiber; 24-10-2019 at 23:21.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  4. #4
    Thanks both,

    Eros I think the core ARRAY series functions may benefit of such ARRAY COPY and ARRAY CLONE functions.
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  5. #5
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,089
    Blog Entries
    5
    Rep Power
    725
    That would be nice!


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •