on close

does anyone remember what the call is for when codea is about to close?

It’s willClose() :smile:

(bottom of ‘Display’ docs page)

@skar @steppers - just a little clarification please - why do you need a function like willClose() ?

@Bri_G Autosaving games is what immediately springs to mind for me.

@Steppers - thanks for that, kinda obvious really. Never thought about the need but nice to know it’s there.

yes, but for me i found i need this when i enable my repositioning mode, this allows me to change the location of my in game assets by dragging them around, if i
forget to disable this mode and then close the project, i want all the new locations to be saved to a tab

i’ve made this mistake a couple times now where i reposition things and then close the project, only to open it back up an realize i didn’t save any of my new positions

@Simeon on that note, it looks like willClose and saveProjectTab do not work well together always causing a crash, sometimes saving the data

function willClose()
  saveProjectTab("Test", "local test = {}" )