Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+2)

If I put show[piece_data.tmini] directly after the extract expression, it prints:

("%%IMG2ADAAMAD/AP8A/wBHAQEALgEDAC0BAQAvAQEAAQEBAC0BAQACAQEAKwEBAAYBAgAmAQMAAgEBAAIBAgAmAQEAAQEBAAMBAgABAQEAJgEBAAEBAQADAQIAAgEBACcBAQAEAQEAAgEBACcBAQAIAQEALwEBAC8BAQAwAQEA/wD/AP8ARQ==")

…which represents a list containing a single string (even though that’s not the syntax for creating a list containing a single string). Let’s call it imglist:

imglist:list "%%IMG2ADAAMAD/AP8A/wBHAQEALgEDAC0BAQAvAQEAAQEBAC0BAQACAQEAKwEBAAYBAgAmAQMAAgEBAAIBAgAmAQEAAQEBAAMBAgABAQEAJgEBAAEBAQADAQIAAgEBACcBAQAEAQEAAgEBACcBAQAIAQEALwEBAC8BAQAwAQEA/wD/AP8ARQ=="

Now print[imglist] will try to convert the list to a string, which works and produces the intended result (as you saw with your “this is what I want” message). However, image[imglist] wants its argument to be an x,y size, and only falls back to trying to interpret a string if it can’t do that. The argument it gets is a list, just not a list of two integers, so you wind up with an 0x0 image.

In general, you probably want to change the way you extract the row from the table:

 piece_data: first rows select
  tname:tname 
  tdesc:tdesc
  tmini:tmini
 where index=row
 from me.value

Now piece_data is a dictionary, as you expected, rather than a table.

In this specific instance, since this is the click handler of a grid, we can assume that the relevant row of the grid is already selected, and we can just say:

piece_data:me.rowvalue

And now the rest of your code should work as you expect.

(1 edit) (+2)

Great explanation, Screwtapello!

In the general case, if you want a specific row of a table at a known index as a dictionary, I'd recommend skipping the query and instead using simple indexing. The following lines are both equivalent to your third example (assuming you just want every column with its original name and order):

piece_data: (rows me.value)[row]
piece_data: me.value[row]