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(pd.datastore.read(animation[1] .. "/framelist")) do
worked = pd.datastore.delete(animation[1] .. "/" .. value)
if worked then
print("Deleted " .. animation[1] .. "/" .. value .. "And it sure worked")
else
print("Deleted " .. animation[1] .. "/" .. value .. "It sure didn't work")
end
end
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
{
playdate.graphics.image: 0x5b817017ca68,
playdate.graphics.image: 0x5b817016fa18,
playdate.graphics.image: 0x5b8170137e28,
playdate.graphics.image: 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!