Restarting and Starting from Editor Difference?

Hi guys, lately I have been noticing a strange difference between when I launch my project from the editor and when I restart it. The below code is an example of this. When I start it from the editor, it only draws the sprites, but when I restart it plays the slides. Does anyone know what restarting does differtly from lanuching? Sorry for the length of the code, its the smallest example I have.
Edit: Fixed code
Edit: Deleted code

@Goatboy76 Your code doesn’t run the way it’s posted.

@dave1707 Should work now. How are you copying it btw? I havent found a reliable way to copy code from the fourms on an iPad.

@Goatboy76 I’m getting the same error as I did the first time. Are you having a problem selecting the code for copy. I noticed that small programs will copy OK, but large ones won’t. Is that what you’re talking about.

error: [string "-- Slides..."]:65: table index is nil

@Goatboy76 Move the line that I show below from the beginning of your code into the function setup. The width and height values aren’t correct until setup starts. The values you’re getting now is off the screen, so the sprite isn’t showing. The reason it works when to do a restart is because setup was already run and so the width and height values are correct.


I had to keep commenting out code to get the program to run enough that I could see what you were asking about.

Run this program in Landscape and Portrait mode to see what’s happening. Do a restart in each position and you’ll see the correct values for both print statements.


function setup()
    print("before setup ",w,h)
    print("after setup ",w,h)   

@dave1707 I had a dependency for the menu class that I didn’t include *face palm. Sorry for the trouble. I think I get the problem now. Its because when its ran from the editor is doesnt set some varibles that are out side of functions. Does this have something to do with the order that your tabs are in?

I cant highlight large sections of code.