Datastore.delete just doesn't work?


Hi! I'm currently making an animation software, and I ran into a problem with saving files. After deleting frames, when saving, the frames don't get deleted, even though the datastore.delete function returns true.

for index, value in ipairs([1] .. "/framelist")) do
        worked = pd.datastore.delete(animation[1] .. "/" .. value)
        if worked then
            print("Deleted " .. animation[1] .. "/" .. value .. "And it sure worked")
            print("Deleted " .. animation[1] .. "/" .. value .. "It sure didn't work")

This is what my code returns:

Deleted TtuU/1And it sure worked
Deleted TtuU/2And it sure worked
Deleted TtuU/3And it sure worked
Deleted TtuU/4And it sure worked
{ 0x5b817017ca68, 0x5b817016fa18, 0x5b8170137e28, 0x5b817013cee8,

For context, animation is a table, with the first element being the animation name and the second element being a table of images, being the frames. Framelist is a table with the list of frames in it for other uses, and it's saved to the animation folder. Here is the folder structure:

[Animation name, this time being TtuU]
        1  2  3  4  5  6  framelist.json

framelist.json only contains 1, 2, 3, 4, not 5 and 6, as they are supposed to be deleted.

Any help would be greatly appriciated!

That does sound like a bug, probably worth posting it over itn he bug reports forum. In any case, I would suggest not using datastore for this. Have you considered using playdate.file and the provided json library?

Sadly it doesn't have a way to save images, and saving a string with 96000 characters would be just a tad bit too much, and would required a large rewrite.

Curses, you are right. That would definitely be a good feature request, seeing as it seems like the code is already there for it.

1 Like

So now you got both a bug report and a feature request to write :smiley: Sorry!

1 Like

Awesome😁 I'm probably taking the lazy route, where I replace those 1x1 images, they probably take up so little space that nobody will care.