How do you work out the correct tab order (or recover from "paste into project" problems)

I think it’s the iPad that adds the period.

. @inoddy. Glad it fixed all your bad projects. Hopefully the problem will be fixed soon. I knew about the code you suggested, but I didn’t think anyone had that many projects to fix. Can you tell me what you’re doing (which projects) that you’re ending up with 2 Main functions in a project. Maybe I can figure out what’s happening.

.@inoddy. I went back and read your original post and saw that you got 2 Main tabs even though there was only one --# Main in the Ants code. I loaded the Ants code and did a “paste into project” and I only got one Main tab. The only way I could get 2 Main tabs was to add another --# Main. The problem I ran into with other code that only had a Main tab was that I would lose the Main tab. The code was there, but the tab wasn’t, and I couldn’t exit out of the editor. The only way out was to close Codea itself. That’s happened twice so far. Not sure if that was caused by forcing 2 Main tabs before that, but after I closed out of Codea and loaded it again, I didn’t expect to lose the Main tab and hang again.

To get two Mains do this:

Create a new empty project
Change the first line to --# Main
Close the project
Press and hold on the project icon and select Copy
Create a new project using the “paste into” option
Open it - voila - two Mains

Since many projects come with the --# Main comment this occurs quite often. But now that I know what causes it I can avoid it.

Does “Paste into Project” still work?
If so, how do you access it?

I can’t get “Paste Into Project” to work either. Apparently it got removed or broken.

How to manually put code into tabs equivalent to a “paste into project” way?
E.g. :108-puzzle-game

You would copy all the code to the Main tab, then create each tab manually. You would then copy each tab code from Main and paste it into the correct tab then remove that tab code from Main. I did all of that for the 10 tabs but the code wouldn’t run because of errors. I have no interest in the project so I didn’t try to figure out and correct the errors. If you try, the loadstring command has been changed to just load. After that I didn’t go any further.

I didn’t have anything else to do so I tried the code again. After you change loadstring to load and run the code, you’ll get errors. Slide the parameter slider from 1 to 2 then back to 1. Tap the run icon (lower left), and the game runs. It’s more of a tutorial program than a game. You have to slide the parameter to the next number each time.

Add RunCode() to setup() in Main, see below. Also, find all occurrences of supportedOrientation and comment them out. That should take care of all the errors and warnings.

function setup()
    LastCode=readProjectData("Code") or 1
    parameter.integer("Choose_a_tab",1,#tabs,LastCode,RunCode)
    RunCode()
end