Page 1 of 1

Data inside a structure

Posted: Sat Dec 12, 2020 11:50 pm
by em_uk
Hi guys and gals.

I am trying to store multiple blobs of 16 bytes - so I thought the easiest way would be to create a list.


Structure LayersStructure
List Data.i()
EndStructure

Global Dim Scenes.LayersStructure(100)

I now have an array with each element containing a Data() integer with a size of 0 - the question is - how do I put and pull data out of that Data() section?

Thanks!

Re: Data inside a structure

Posted: Sun Dec 13, 2020 12:09 am
by em_uk
Not to worry,

I've changed it to

Code: Select all

Structure LayersStructure
  Array Data.i(64)
EndStructure
Now I can access with Scenes(0)\Data(0)

Re: Data inside a structure

Posted: Sun Dec 13, 2020 10:47 am
by infratec
Only as hint:

Code: Select all

Structure LayersStructure
  Map Data.i()
EndStructure

Global Dim Scenes.LayersStructure(100)

Scenes(0)\Data("0") = 10

If FindMapElement(Scenes(0)\Data(), "0")
  Debug Scenes(0)\Data()
EndIf

Re: Data inside a structure

Posted: Sun Dec 13, 2020 11:54 am
by mk-soft
em_uk wrote: I am trying to store multiple blobs of 16 bytes - so I thought the easiest way would be to create a list.

Code: Select all

;-TOP

Structure LayersStructure
  StructureUnion
    bArray.b[16] ; 0..15
    aArray.a[16] ; 0..15
  EndStructureUnion
EndStructure

Global Dim MyData.LayersStructure(100) ; 0 .. 100

MyData(0)\aArray[0] = 255

Debug MyData(0)\aArray[0] ; Unsigned
Debug MyData(0)\bArray[0] ; Signed