Codea Craft 2.5 (84) Beta - Updated 8/9/2017

@piinthesky that started happening to me, and I got close to chucking my iPad at the wall, but what I do now is make everything safer by using dependencies. Make different projects that have some classes, and just declare them as dependencies in your master project. Also, I would add buffer tabs called “zzzz”,“zzzzzz”, etc. which were blank, so that they would be the ones to go if anything got wiped out. Also, as @dave1707 said, its not that hard to back up your projects, better safe than sorry.

@CamelCoder @piinthesky What were each of you doing that caused the tabs to be deleted. Are they deleted while you’re editing the code, when you first open a project, after the project is executed, etc. If you can describe what you were doing when the tabs got deleted, maybe that will help them to track down the error and fix it. I don’t use a lot of tabs, so I’ve never had that problem which is why I’m asking what each of you were doing. I guess I could create a project and keep adding tabs, but maybe I’ll wait to hear your causes before trying to duplicate the problem.

@dave1707 it’s random at best. When you open a project, you just realize that some tabs are gone. It only happens for me with projects with at least 20-some tabs. It happens to the last tabs.

@CamelCoder Thanks. That means the problem could be when the project is opening (reading) or when it’s being closed (saving). I have a test project with 50 tabs/classes that I’m trying anything with. No problems so far. Maybe I’ll add more tabs/classes.

@CamelCoder @piinthesky I’m trying to get this one fixed today. What devices are you using?

@dave1707 if you just add a ton of empty classes, I don’t think it would work, just add like 1000 lines of lorum ipsum on each tab in the form of a string, and then keep running it. Again, its very random, it may not even happen for you, and it also doesn’t happen very often

@CamelCoder I’m trying to replicate by duplicating the Cargo-Bot project and rapidly opening / closing it, editing it, closing it, and so on. So far I have not been able to reproduce. Does this trigger it for you?

@piinthesky @CamelCoder have you tried archiving and looking at the project folder on a computer to see if its the tabs that are missing or just the tab info that is corrupted / missing in the Info.plist file? In the beta version you can also grab the project straight out of iTunes using File Sharing.

@Simeon I don’t know what triggered it for me to be honest. I was just working on my game Mazoo - The Ultimate 3D Maze and it had a lot of tabs and a lot of code on each of the files. Then, I would open it, and like once in a while (every 100 times or so), it would crash.

@John I haven’t really been using my iPad lately because my iPad’s screen is getting fixed, so I’m sorry, can’t really test it

@john i exported the affected project to my mac…the missing tabs are not listed in the ‘buffer order’ and are not listed in the .codea directory. So as far as i can tell there is no obvious ‘corruption’.

I have managed to regenerate the code which disappeared, so feeling better now!
I will be more disciplined with my backups from now on and will start putting multiple classes in a single tab!

Keep up the excellent work with wonderful Codea.

@piinthesky @CamelCoder Do you remember if you had a lot of other apps loaded or just Codea. Just trying to think of anything that might be a cause.

@Simeon @John @dave1707 @piinthesky @CamelCoder Not sure whether this will be any help because the affected project had under 10 tabs but I think I may have seen this once when I tried to run a project after renaming a tab I found another tab had mysteriously vanished.

At the time I thought nothing of it and just restored it from Working Copy assuming that I had deleted it by accident whilst prodding for the rename button. Except I remember that something odd happened before it that could be related.

I had left my iPad idle for a while, perhaps 15-30mins, maybe more with another app focused. Then when I switched back to Codea it froze and then crashed(?) back to the projects screen so I had to reopen the project.

I don’t know whether the tab was lost immediately after reopening the project, upon renaming the tab or I really did just delete it by mistake :D. It hasn’t happened since although I still see the freezing back to projects screen thing happening sometimes, generally after coming back from putting my iPad down for a bit.

@dave1707, yes normally i have lots of other apps loaded

@dave1707 I literally keep constant on swiping up all my apps, except Codea. Codea is always the only app loaded for me. Besides maybe sometimes Clash Royale, but not often, and probably not when it happened

@Simeon @John When does a tab get saved. If the contents of a tab is changed, does the tab get saved when switching to another tab, or does everything get saved only once when exiting Codea. Trying to get as much info as possible on a cause.

@Simeon @John I’ve been trying different things to get the tabs to delete themselves, but I ran into something interesting that might help. I created a project and ran the code below. It would print Main as the tab name, and then show the code in Main. When I created a class/tab Z1 and ran the code, it printed Main as the tab name and listed the Main code, printed Z1 as the tab name but then printed an error message. It was as if the class code was being shown in the editor, but wasn’t saved anywhere to be read. When I closed the editor and then opened the code again and ran it, it printed both tabs OK. I created another class/tab and ran the code. It printed Main and the first tab OK, but then it printed the new class/tab name and then an error message when it tried to print the new class code. I was able to do that several times with other new class/tabs. I tried to get more specific trying other things, but then I couldn’t get it to happen anymore. I should have saved what the error message was, but I didn’t think it would stop happening since it did it right away and kept happening. Basically the error was that there wasn’t anything to read for the class/tab I just created. I’ll keep playing around with this to see if I can get it to happen again. There wasn’t anything special I did before this happened. I just thought I’d try doing this and was surprised when I got the error.

function setup()
    tab=listProjectTabs()
    for a,b in pairs(tab) do
        print(a,b)
        print(readProjectTab(b))
    end
end

@Simeon @John Here’s something else I ran into when trying to duplicate tabs disappearing. Try this; create a project called B1 (note upper case B). Replace the code with the code below (note the lower case b) in listProjectTabs. Add a new class/tab to the project with any name you want. Run the code and it will print the code shown below without showing the added class/tab code. Change the lower case b to B and run the code again. It shows the code below and the class/tab code. I expected when the code is run with the lower case b to not show any code because there isn’t any project called b1. But if I add a comment to the Main code and run it as b1, it shows the comment that was added, but without the class/tab code. So I’m not sure what’s going on with updating the code and why a lower case b shows the Main code without the tab code, but the upper case B shows all the code.

function setup()
    tab=listProjectTabs("b1")
    for a,b in pairs(tab) do
        print(a,b)
        print(readProjectTab(b))
    end
end

I tested mapping a planet surface texture around a sphere using craft, and it worked pretty well! However there is one small bug wich i know how to fix. Here is a small example video:
https://youtu.be/G8YHtnPM9uc

Also now I wonder, can I save a mesh I created using Craft as a .obj file?

What is the default coordinate plane and the default rotation in craft?

@John or @Simeon
When creating a custom mesh, I always get a error when resizeing the indicescount:

function setup()

    mesh = craft.mesh()
    mesh:resizeIndices(300)

end

Btw I have craft selected in the dependencies, and I wrote this code from scratch(I didnt copy the code from my Ipad, but On there I am pretty sure its correct and the same thing as above. Is this a bug or something?

Edit: So I found out its a bug in Codea, and the actual method name is resizeIndicies()
I am not sure tough about the resizeVertices(), it doesnt work either. Please @John fix this for the next update.