How to implement something similar to C structs in Squirrel?

I’d like to implement something similar to structs and typedefs in Squirrel, but after reading the (not so verbose) squirrel 3.0 ref page, I’m still not sure how to implement something similar to this:

Here’s some example code from a random project of mine, so you can have an idear about what it is I’m looking to perform:

`struct Info_Structure1
{
unsigned long leadSignature;
unsigned char reserved1[480];
unsigned long structureSignature;
unsigned long freeCCount;
unsigned long nextFreeC;
unsigned char reserved2[12];
unsigned long trailSignature;
};

struct Info_Structure2
{
unsigned long leadSignature;
unsigned char ExtraInfo[100];
unsigned char reserved1[380];
unsigned long structureSignature;
unsigned long freeCCount;
unsigned long nextFreeC;
unsigned char reserved2[12];
unsigned long trailSignature;
};

// … There are many more Info structures that I need to be able to parse.`

and used from the main code like this:

`volatile unsigned char buffer[512]; // Global buffer

unsigned char decodeInfo(void)
{
struct Info_Structure1 *sInfo1 = (struct Info_Structure1 *) &buffer;
struct Info_Structure2 *sInfo2 = (struct Info_Structure2 *) &buffer;

if(sInfo1->leadSignature == 0x41615252)
{

}
else
if(sInfo2->leadSignature == 0x41615253)
{

}
else
{
return 0xff;
}
}
`

I’m looking forward for any assistance…

There’s no equivalent to that; the only way you could decode a packed struct like that would be to put it into a blob and use the blob stream seek and read calls.

Thanks, that explains why I couldn’t find it. :frowning: