Utility: Automatic backup and recovery of your project code

Hello Ignatz the idea of this utility is great, making a backup works fine, but I can not restore a backup, there is a problem with the local img variable (indexing a nil value). I checked the code I copied and i cant find any mistakes. Can you help me to solve this. I am new at Codea just started a few days ago.


Try the version immediately above your post. If that fails, please send me your code and I’ll try to find the problem. (And welcome, I’ve only been here a month, and still loving it).

I reinstall the latest version 1.1 but the result is the same I get the following error:

error: [string “Restore = class()…”]:4: attempt to index local ‘img’ (a nil value)

I think it is this line of code : local r,g,b,a=img:get(1,1) at the Restore tab

How are you calling the Restore function? Please post the code.

– testbackup

– Use this function to perform your initial setup
function setup()

img=readImage(“Dropbox:Zeeslag Ver 1.03”)



It sounds like Codea doesn’t think it’s a proper image in the right format, because all the offending line does is to read the first pixel. That should work for any valid image. If you look at the image file it should be a jumbled mix of pixels of different colours. I’ll have a play with it in the morning (it’s late here).

Oke its here 18.00
If i look at the back up i see a mix of different colours that looks oke
I will check the backup part again maybe something wrong there after copiing

If it still doesn’t work, perhaps you can put your code where I can find it, and then I can solve it perhaps

I think i found the problem the command readimage did not work with the created backup image
May be the fault is in the creation of the backup image?
It is strange the program verifys the backupimage with the same restorefunctions

It does use the same functions, but there is one difference. The verify test uses the image in memory, not the one just saved, so there may be a problem in the saving process. I’ll look at that. Thanks for the diagnosis.

This is amazingly useful… You have no idea. An it’s on the cloud! Your a genius.

I found the ERROR:-)
It is possible in Codea to save an image like this: saveImage(“Dropbox:Myproject Ver 1.1”,img)
It is NOT possible to get the image with readImage(“Dropbox:Myproject Ver 1.1”)
It is not allowed to use a DOT in the imagename in the function readImage.
If you use names without DOTS then you have no problem.
Is this a bug?

Thank you very much for that, I’ll include a note in the code

Ooooh, does this ever look useful…

Although, am I the only one who gets (after having created a “Backup” project and having pasted the whole code inside it as main) a “0 available tabs” and, once checked, “0 imported tabs” when setting the dependencies in the project I want to backup?

(As such:
https://www.dropbox.com/s/239dkla11d5y5hm/2013-07-20%2012.02.40-1.jpg )

@Rudolphe - instead of pasting all the code as Main, hold down Add New Project until you get the option Paste into New Project. That will paste into all the tabs.

Let me know if you have a problem.

Thanks! I didn’t know this, it imports great, and it says my backup is verified! :smiley:

I’m trying to see the backed up file in my dropbox folder, but can’t see it though, and dropbox doesn’t look like it’s syncing anything…

It should look like a gray picture

Hmmm, can’t see any of that in my Dropbox. It seems odd to me since I get the “backup made” and “backup verified” message when running my project with a new version number. Should it be in a particular folder?

You aren’t using a full stop in the name, I hope.

Codea doesn’t like that.

Nope, here’s what I have:

I also tried without going through a variable holding the text, with the same result