Skip to main content

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

In Decker’s list of built-in functions, the last function in the list is:

write[x hint] Open a modal dialog prompting the user to save x.

…with a pointer to additional information lower down. That additional information includes:

image interfaces are written as GIF89a images, and a .gif extension will be appended to any filename without it.

So if we can get an “image interface”, we can let the user save that as a GIF file. Where do image interfaces come from?

Searching the docs for “image interface”, it looks like we can create one from scratch with image[], we can get one by read[]ing a GIF file, you can get images that already exist in a rich-text widget, but none of those are what we want. However, there’s another hit in the App Interface section:

x.render[x] Draw the visual appearance of card or widget x as an Image interface.

…so if we can get an “app interface” from somewhere, we can use it to turn any card or widget into an image interface, which we can pass to write[] to save it as a GIF. A bit earlier in the App Interface docs, it says:

It is available as a global constant named app.

…so we can just say app to refer to the app interface. If a card has a name that’s valid for a Lil variable, then that name is also globally available. If your results card is called, for example, results, then you should be able to save it as a GIF like this:

write[app.render[results]]

Unfortunately, there’s no way to suggest a filename, or where it gets saved. That’s partially for simplicity, but also because Decker can be run in a browser, and browsers are pretty strict about what you’re allowed to do for security reasons.