Getting size of BitmapTable in C

In Lua, there are and its alias This probably proves that there is a use case, otherwise they wouldn't have been added.

In C, there is no equivalent as of SDK 2.4.2.

I'm imagining something along the lines of:

int playdate->graphics->getBitmapTableLength(LCDBitmapTable* table);

An ugly workaround is to call getTableBitmap in a loop until it returns NULL.

It just so happens that the first element of the LCDBitmapTable struct is a uint16_t containing the number of images. Simply do this to get the length:

int length = *(uint16_t *)table;

...though of course this is highly undocumented.

In 2.5 we're adding

void getBitmapTableInfo(LCDBitmapTable* table, int* count, int* width)

to playdate->graphics so you can get the image count of the table and the number of cells across.